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

version» Context lines:

Roxen.git/server/etc/modules/PropertySet.pike:47:   //! Return an @[Stdio.Stat] object for the resource. Its main use is   //! to tell collections (i.e. directories) from non-collections.   Stat get_stat();      //! Called by the default @[query_property] implementation to get the   //! response headers a GET or HEAD request on @[path] would yield.   //! It's used to fill in the properties that should reflect various   //! response headers.   mapping(string:string) get_response_headers();    + // Simulate an import of useful stuff from Parser.XML.Tree. + static constant SimpleNode = Parser.XML.Tree.SimpleNode; + static constant SimpleElementNode = Parser.XML.Tree.SimpleElementNode; +    private constant all_properties_common = (<    "DAV:getcontentlength",    "DAV:getcontenttype",    "DAV:displayname",    "DAV:resourcetype",    "DAV:supportedlock",    "DAV:iscollection",    "DAV:isfolder",    "DAV:lockdiscovery",    "DAV:supportedlock",
Roxen.git/server/etc/modules/PropertySet.pike:257:      //! 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(Parser.XML.Tree.Node)|mapping(string:mixed) + 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();    int t = stat->ctime;    if (t > stat->atime) t = stat->atime;
Roxen.git/server/etc/modules/PropertySet.pike:298:       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) {    return ({ -  Parser.XML.Tree.ElementNode("DAV:collection", ([])), // 12.2 +  SimpleElementNode("DAV:collection", ([])), // 12.2    });    }    return 0;       case "DAV:supportedlock": // RFC2518 13.11    { -  array(Parser.XML.Tree.Node) res = ({ -  Parser.XML.Tree.ElementNode("DAV:lockentry", ([])), -  Parser.XML.Tree.ElementNode("DAV:lockentry", ([])), +  return ({ +  SimpleElementNode("DAV:lockentry", ([]))-> +  add_child(SimpleElementNode("DAV:lockscope", ([]))-> +  add_child(SimpleElementNode("DAV:exclusive", ([]))))-> +  add_child(SimpleElementNode("DAV:locktype", ([]))-> +  add_child(SimpleElementNode("DAV:write", ([])))), +  +  SimpleElementNode("DAV:lockentry", ([]))-> +  add_child(SimpleElementNode("DAV:lockscope", ([]))-> +  add_child(SimpleElementNode("DAV:shared", ([]))))-> +  add_child(SimpleElementNode("DAV:locktype", ([]))-> +  add_child(SimpleElementNode("DAV:write", ([])))),    }); -  res[0]->add_child(Parser.XML.Tree.ElementNode("DAV:lockscope", ([])))-> -  add_child(Parser.XML.Tree.ElementNode("DAV:exclusive", ([]))); -  res[1]->add_child(Parser.XML.Tree.ElementNode("DAV:lockscope", ([])))-> -  add_child(Parser.XML.Tree.ElementNode("DAV:shared", ([]))); -  res[0]->add_child(Parser.XML.Tree.ElementNode("DAV:locktype", ([])))-> -  add_child(Parser.XML.Tree.ElementNode("DAV:write", ([]))); -  res[1]->add_child(Parser.XML.Tree.ElementNode("DAV:locktype", ([])))-> -  add_child(Parser.XML.Tree.ElementNode("DAV:write", ([]))); -  return res; +     }    case "http://apache.org/dav/props/executable":    // http://www.webdav.org/mod_dav/:    //    // Name: executable    // 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
Roxen.git/server/etc/modules/PropertySet.pike:466:   //! any level in the inherit hierachy take precedence over dead   //! properties.   //!   //! @note   //! RFC 2518: Live property - A property whose semantics and syntax   //! are enforced by the server. For example, the live   //! @tt{"getcontentlength"@} property has its value, the length of the   //! entity returned by a GET request, automatically calculated by   //! the server.   mapping(string:mixed) set_property(string prop_name, -  string|array(Parser.XML.Tree.Node) value) +  string|array(SimpleNode) value)   {    switch(prop_name) {    case "http://apache.org/dav/props/executable":    // FIXME: Could probably be implemented R/W.    // FALL_THROUGH    case "DAV:displayname": // 13.2    case "DAV:getcontentlength": // 13.4    case "DAV:getcontenttype": // 13.5    case "DAV:getlastmodified": // 13.7    return Roxen.http_status (Protocols.HTTP.HTTP_CONFLICT,
Roxen.git/server/etc/modules/PropertySet.pike:507:   //! The default implementation currently does not support setting   //! of dead properties, and will return an error code.   //!   //! @note   //! RFC 2518: Dead Property - A property whose semantics and syntax   //! are not enforced by the server. The server only records the   //! value of a dead property; the client is responsible for   //! maintaining the consistency of the syntax and semantics of a   //! dead property.   mapping(string:mixed) set_dead_property(string prop_name, -  array(Parser.XML.Tree.Node) value) +  array(SimpleNode) value)   {    return Roxen.http_status (Protocols.HTTP.HTTP_METHOD_INVALID,    "Setting of dead properties is not supported.");   }      //! Attempt to remove the property @[prop_name].   //!   //! @note   //! Actual removal of the property should be done first   //! when @[commit()] is called, or unrolled