Branch: Tag:

2000-08-15

2000-08-15 12:45:38 by Johan Sundström <oyasumi@gmail.com>

Some stricter types. Some refdoc. If an extension module returns the original fd it was given, don't destruct it. Finally, a stat array is seven entries long; no more, no less.

Rev: server/base_server/configuration.pike:1.338

1:   // A vitual server's main configuration   // Copyright ¬© 1996 - 2000, Roxen IS.    - constant cvs_version = "$Id: configuration.pike,v 1.337 2000/08/14 22:50:53 mast Exp $"; + constant cvs_version = "$Id: configuration.pike,v 1.338 2000/08/15 12:45:38 jhs Exp $";   constant is_configuration = 1;   #include <module.h>   #include <module_constants.h>
441:         array location_modules(RequestID id) + //! Return an array of all location modules the request would be + //! mapped through, by order of priority.   {    if(!location_module_cache)    {
1141:    return res;   }    - // The function that actually tries to find the data requested. All - // modules are mapped, in order, and the first one that returns a - // suitable responce is used. - mapping|int low_get_file(RequestID id, int|void no_magic) + mapping|int(-1..0) low_get_file(RequestID id, int|void no_magic) + //! The function that actually tries to find the data requested. All + //! modules except last and filter type modules are mapped, in order, + //! and the first one that returns a suitable response is used. If + //! `no_magic' is set to one, the internal magic roxen images and the + //! <ref>find_internal()</ref> callbacks will be ignored. + //! + //! The return values 0 (no such file) and -1 (the data is a + //! directory) are only returned when `no_magic' was set to 1; + //! otherwise a result mapping is always generated.   {   #ifdef MODULE_LEVEL_SECURITY    int slevel;
1159:    string loc;    function funp;    mixed tmp, tmp2; -  mapping|object fid; +  mapping|object(Stdio.File)|int fid;       if(!no_magic)    {
1171: Inside #if undefined(NO_INTERNAL_HACK) and #if defined(OLD_RXML_COMPAT)
   if(sizeof(file) > 17 &&   #ifdef OLD_RXML_COMPAT    (file[0] == '/') && -  sscanf(file, "%*s/internal-%s-%[^/]", type, loc) == 3) +  sscanf(file, "%*s/internal-%s-%[^/]", type, loc) == 3   #else -  sscanf(file, "/internal-%s-%[^/]", type, loc) == 2) +  sscanf(file, "/internal-%s-%[^/]", type, loc) == 2   #endif -  { +  ) {    switch(type) {    case "roxen":    TRACE_LEAVE("Magic internal gopher image");
1439:    TRACE_LEAVE("Returning data");    return tmp;    } -  if(fid) +  if(fid && tmp != fid)    destruct(fid);    TRACE_LEAVE("Returned new open file");    fid = tmp;
1503:   }      mapping get_file(RequestID id, int|void no_magic, int|void internal_get) + //! Return a result mapping for the id object at hand, mapping all + //! modules, including the filter modules. This function is mostly a + //! wrapper for <ref>low_get_file()</ref>.   {    int orig_internal_get = id->misc->internal_get;    id->misc->internal_get = internal_get;
1978:    loc=loc[strlen(file)..];    sscanf(loc, "%s/", loc);    if (!dir[loc]) { -  dir[loc] = ({ 0775, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); +  dir[loc] = ({ 0775, -3, 0, 0, 0, 0, 0 });    }    TRACE_LEAVE("");    }