Roxen.git / server / etc / modules / PropertySet.pike

version» Context lines:

Roxen.git/server/etc/modules/PropertySet.pike:239:   //! Unknown definition.   //! @endstring   //!   //! Also, the MS DAV client requires a type argument to be able to   //! parse date/time fields correctly, even when they are formatted   //! according to the standard. @[XMLPropStatNode.add_property] has   //! special cases for this for @tt{DAV:creationdate@} and   //! @tt{DAV:getlastmodified@}.   multiset(string) query_all_properties()   { +  Stat st = get_stat(); +  if (st) {    multiset(string) props =    (get_stat()->isreg ? all_properties_file : all_properties_dir) + (<>);       // This isn't necessary for the Content-Length and Content-Type    // headers since RequestID.make_response_headers always sets those.    mapping(string:string) hdrs = get_response_headers();    if (hdrs["Content-Language"]) props["DAV:getcontentlanguage"] = 1;    if (hdrs->ETag) props["DAV:getetag"] = 1;    if (hdrs["Last-Modified"]) props["DAV:getlastmodified"] = 1; -  +     return props;    } -  +  // Null resource. +  return all_properties_common + (<>); + }      //! Returns the value of the specified property, or an error code   //! mapping.   //!   //! The default implementation takes care of the most important RFC   //! 2518 properties.   //!   //! @note   //! Returning a string is shorthand for returning an array   //! with a single text node.   string|array(SimpleNode)|mapping(string:mixed)    query_property(string prop_name)   {    switch(prop_name) {   #if 0    // We don't really have any idea of the creation time in a unix    // style file system.    case "DAV:creationdate": // RFC2518 13.1    Stdio.Stat stat = get_stat(); -  +  if (stat) {    int t = stat->ctime;    if (t > stat->atime) t = stat->atime;    if (t > stat->mtime) t = stat->mtime;    return Roxen.iso8601_date_time(t); // MS kludge. -  +  } +  break;   #endif       case "DAV:displayname": // RFC2518 13.2    if ((path == "") || (path == "/")) return "/";    if (path[-1] == '/') return basename(path[..sizeof(path)-2]);    return basename(path);       case "DAV:getcontentlanguage":// RFC2518 13.3    return get_response_headers()["Content-Language"];   
Roxen.git/server/etc/modules/PropertySet.pike:300:    case "DAV:getetag": // RFC2518 13.6    return get_response_headers()->ETag;       case "DAV:getlastmodified": // RFC2518 13.7    return get_response_headers()["Last-Modified"];       case "DAV:lockdiscovery": // RFC2518 13.8    return indices(id->conf->find_locks(abs_path, 0, 0, id))->get_xml();       case "DAV:resourcetype": // RFC2518 13.9 -  if (get_stat()->isdir) { +  if ((get_stat()||([]))->isdir) {    return ({    SimpleElementNode("DAV:collection", ([])), // 12.2    });    }    return 0;       case "DAV:supportedlock": // RFC2518 13.11    {    return ({    SimpleElementNode("DAV:lockentry", ([]))->
Roxen.git/server/etc/modules/PropertySet.pike:337:    // Namespace: http://apache.org/dav/props/    // Purpose: Describes the executable status of the resource.    // Value: "T" | "F" (case is significant)    // Description: This property is defined by mod_dav's default    // repository, the "filesystem" repository. It    // corresponds to the "executable" permission flag    // in most filesystems.    //    // This property is not defined on collections.    Stdio.Stat stat = get_stat(); -  if (stat->isreg) { +  if (stat && stat->isreg) {    if (stat->mode & 0111) return "T";    return "F";    }    break;      #if 0    // Need more interaction with directory listing modules to handle    // this.    case "DAV:defaultdocument": // draft-hopmann-collection-props-00 1.3    return "";
Roxen.git/server/etc/modules/PropertySet.pike:360: Inside #if 0
   case "DAV:ishidden": // draft-hopmann-collection-props-00 1.6    return "0";       // Absence means not a structured document.    case "DAV:isstructureddocument": // draft-hopmann-collection-props-00 1.7    return "0";   #endif       case "DAV:iscollection": // draft-ietf-dasl-protocol-00 5.18    case "DAV:isfolder": // draft-hopmann-collection-props-00 1.5 -  if (get_stat()->isdir) { +  if ((get_stat()||([]))->isdir) {    return "1";    }    return "0";      #if 0    // The following are properties in the DAV namespace    // that Microsoft has stolen.    case "DAV:isreadonly": // MS -  if (!(get_stat()->mode & 0222)) { +  if (!((get_stat()||(["mode":0222]))->mode & 0222)) {    return "1";    }    return "0";    case "DAV:isroot": // MS    if (path == "") return "1";    return "0";    case "DAV:lastaccessed": // MS -  return Roxen.iso8601_date_time(get_stat()->atime); +  return Roxen.iso8601_date_time((get_stat()||([]))->atime);    case "DAV:href": // MS    return id->url_base() + abs_path[1..];    case "DAV:contentclass": // MS    return "";    case "DAV:parentname": // MS    return "";    case "DAV:name": // MS    return abs_path;   #endif /* 0 */