Roxen.git / server / base_server / module.pike

version» Context lines:

Roxen.git/server/base_server/module.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2001, Roxen IS. - // $Id: module.pike,v 1.148 2003/12/22 17:12:17 grubba Exp $ + // $Id: module.pike,v 1.149 2004/03/01 15:43:20 mast Exp $      #include <module_constants.h>   #include <module.h>   #include <request_trace.h>      constant __pragma_save_parent__ = 1;      inherit "basic_defvar";   mapping(string:array(int)) error_log=([]);   
Roxen.git/server/base_server/module.pike:282:    TRACE_LEAVE("No stat info");    }    }       TRACE_LEAVE("");    return(res);   }      //! Returns a multiset with the names of all supported properties.   //! + //! @param st + //! If set, this should be the stat that corresponds to @[path]. Its + //! only purpose is to save a call to @[stat_file] when the stat + //! already has been retrieved. + //!   //! @note   //! Only properties that should be listed by @tt{<DAV:allprop/>@}   //! are returned.   //!   //! @note   //! The following properties are required to keep   //! @tt{Microsoft Data Access Internet Publishing Provider DAV 1.1@}   //! as supplied with @tt{Microsoft Windows 2000@} happy:   //! @string   //! @value "DAV:creationdate"
Roxen.git/server/base_server/module.pike:418:   //! @value "DAV:parentname"   //! Microsoft specific.   //!   //! The @tt{DAV:parentname@} field specifies the name of the folder   //! that contains an item.   //! @value "DAV:name"   //! Microsoft specific.   //!   //! Unknown definition.   //! @endstring - multiset(string) query_all_properties(string path, RequestID id) + multiset(string) query_all_properties(string path, RequestID id, void|Stat st)   { -  Stat st = stat_file(path, id); +  if (!st) { +  st = stat_file(path, id);    if (!st) return (<>); -  +  }    multiset(string) res = (<    "DAV:creationdate", // RFC2518 13.1    "DAV:displayname", // RFC2518 13.2    //"DAV:getcontentlanguage", // RFC2518 13.3    "DAV:getcontentlength", // RFC2518 13.4    "DAV:getcontenttype", // RFC2518 13.5    "DAV:getetag", // RFC2518 13.6    "DAV:getlastmodified", // RFC2518 13.7    "DAV:resourcetype", // RFC2518 13.9    "DAV:supportedlock", // RFC2518 13.11
Roxen.git/server/base_server/module.pike:461:    //"DAV:isstructureddocument", // draft-hopmann-collection-props-00 1.7    //"DAV:isroot", // MS uses this.    >);    }    return res;   }      //! Returns the value of the specified property, or an error code   //! mapping.   //! + //! @param st + //! If set, this should be the stat that corresponds to @[path]. Its + //! only purpose is to save a call to @[stat_file] when the stat + //! already has been retrieved. + //!   //! @note   //! Returning a string is shorthand for returning an array   //! with a single text node.   string|array(Parser.XML.Tree.Node)|mapping(string:mixed) -  query_property(string path, string prop_name, RequestID id) +  query_property(string path, string prop_name, RequestID id, void|Stat st)   { -  Stat st = stat_file(path, id); -  if (!st) return Roxen.http_low_answer(404, "No such file or directory."); +  if (!st) { +  st = stat_file(path, id); +  if (!st) +  return Roxen.http_low_answer(404, "No such file or directory."); +  }    switch(prop_name) {    case "DAV:creationdate": // RFC2518 13.1    int t = st->ctime;    if (t > st->atime) t = st->atime;    if (t > st->mtime) t = st->mtime;    return Roxen.iso8601_date_time(t); // MS kludge.    case "DAV:displayname": // RFC2518 13.2    return combine_path(query_location(), path);    case "DAV:getcontentlanguage":// RFC2518 13.3    return "en"; // MS kludge.
Roxen.git/server/base_server/module.pike:692:   //! Query after properties specified by @[filt] and   //! their values.   //! @endstring   //! @param result   //! Result object.   //! @param id   //! Id of the current request.   //! @param filt   //! Optional multiset of requested properties. If this parameter   //! is @expr{0@} (zero) then all available properties are requested. + //! @param st + //! If set, this should be the stat that corresponds to @[path]. Its + //! only purpose is to save a call to @[stat_file] when the stat + //! already has been retrieved.   //!   //! @note   //! id->not_query() does not necessarily contain the same value as @[path].   void find_properties(string path, string mode, MultiStatus result, -  RequestID id, multiset(string)|void filt) +  RequestID id, multiset(string)|void filt, void|Stat st)   { -  Stat st = stat_file(path, id); +  if (!st) { +  st = stat_file(path, id);    if (!st) return; -  +  }       switch(mode) {    case "DAV:propname": -  foreach(indices(query_all_properties(path, id)), string prop_name) { +  foreach(indices(query_all_properties(path, id, st)), string prop_name) {    result->add_property(path, prop_name, "");    }    return;    case "DAV:allprop":    if (filt) {    // Used in http://sapportals.com/xmlns/cm/webdavinclude case.    // (draft-reschke-webdav-allprop-include-04). -  filt |= query_all_properties(path, id); +  filt |= query_all_properties(path, id, st);    } else { -  filt = query_all_properties(path, id); +  filt = query_all_properties(path, id, st);    }    // FALL_THROUGH    case "DAV:prop":    foreach(indices(filt), string prop_name) {    result->add_property(path, prop_name, -  query_property(path, prop_name, id)); +  query_property(path, prop_name, id, st));    }    return;    }    // FIXME: Unsupported DAV operation.    return;   }      void recurse_find_properties(string path, string mode, int depth,    MultiStatus result, -  RequestID id, multiset(string)|void filt) +  RequestID id, multiset(string)|void filt, void|Stat st)   { -  Stat st = stat_file(path, id); +  if (!st) { +  st = stat_file(path, id);    if (!st) return; -  +  }    -  find_properties(path, mode, result, id, filt); +  find_properties(path, mode, result, id, filt, st);    if ((depth <= 0) || !st->isdir) return;    depth--;    foreach(find_dir(path, id), string filename) {    recurse_find_properties(combine_path(path, filename), mode, depth,    result, id, filt);    }   }      // RFC 2518 8.2   // Instructions MUST either all be executed or none executed.