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 - 2004, Roxen IS. - // $Id: module.pike,v 1.227 2006/10/13 18:20:38 mast Exp $ + // $Id: module.pike,v 1.228 2008/03/19 14:08:01 grubba 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:86:      array register_module()   {    return ({    this_object()->module_type,    this_object()->module_name,    this_object()->module_doc,    0,    module_unique,    this_object()->module_locked, +  this_object()->module_counter,    });   }      string fix_cvs(string from)   {    from = replace(from, ({ "$", "Id: "," Exp $" }), ({"","",""}));    sscanf(from, "%*s,v %s", from);    return replace(from,"/","-");   }   
Roxen.git/server/base_server/module.pike:325:   }      void set_status_for_path (string path, RequestID id, int status_code,    string|void message, mixed... args)   //! Register a status to be included in the response that applies only   //! for the given path. This is used for recursive operations that can   //! yield different results for different encountered files or   //! directories.   //!   //! The status is stored in the @[MultiStatus] object returned by - //! @[id->get_multi_status]. The server will use it to make a 207 + //! @[RequestID.get_multi_status]. The server will use it to make a 207   //! Multi-Status response iff the module returns an empty mapping as   //! response.   //!   //! @param path   //! Path (below the filesystem location) to which the status applies.   //!   //! @param status_code   //! The HTTP status code.   //!   //! @param message
Roxen.git/server/base_server/module.pike:347:   //! message may contain line feeds ('\n') and ISO-8859-1   //! characters in the ranges 32..126 and 128..255. Line feeds are   //! converted to spaces if the response format doesn't allow them.   //!   //! @param args   //! If there are more arguments after @[message] then @[message]   //! is taken as an @[sprintf] style format string which is used to   //! format @[args].   //!   //! @note - //! This function is just a wrapper for @[id->set_status_for_path] + //! This function is just a wrapper for @[RequestID.set_status_for_path]   //! that corrects for the filesystem location.   //!   //! @seealso   //! @[RequestID.set_status_for_path], @[Roxen.http_status]   {    if (sizeof (args)) message = sprintf (message, @args);    id->set_status_for_path (query_location() + path, status_code, message);   }      Stat stat_file(string f, RequestID id){}
Roxen.git/server/base_server/module.pike:1327:   //!   //! The default implementation handles the recursion and calls   //! @[delete_file] for each file and empty directory.   //!   //! @returns   //! Returns a 2xx series status mapping on success (typically 204 No   //! Content). Returns 0 if the file doesn't exist. Returns an   //! appropriate status mapping for any other error. That includes an   //! empty mapping in case some subparts couldn't be deleted, to   //! signify a 207 Multi-Status response using the info in - //! @[id->get_multi_status()]. + //! @[RequestID.get_multi_status()].   mapping(string:mixed) recurse_delete_files(string path,    RequestID id,    void|MultiStatus.Prefixed stat)   {    SIMPLE_TRACE_ENTER (this, "Deleting %O recursively", path);    if (!stat)    stat = id->get_multi_status()->prefix (id->url_base() +    query_location()[1..]);       Stat st = stat_file(path, id);
Roxen.git/server/base_server/module.pike:1495:   //! subparts fail. It's prefixed with the URL to the filesystem   //! location.   //!   //! @returns   //! Returns a 2xx series status mapping on success (typically 201   //! Created if the destination didn't exist before, or 204 No   //! Content otherwise). Returns 0 if the source doesn't exist.   //! Returns an appropriate status mapping for any other error. That   //! includes an empty mapping in case there's a failure on some   //! subpart or at the destination, to signify a 207 Multi-Status - //! response using the info in @[id->get_multi_status()]. + //! response using the info in @[RequestID.get_multi_status()].   static mapping(string:mixed) copy_collection(string source,    string destination,    PropertyBehavior behavior,    Overwrite overwrite,    MultiStatus.Prefixed result,    RequestID id)   {    SIMPLE_TRACE_ENTER(this, "copy_collection(%O, %O, %O, %O, %O, %O).",    source, destination, behavior, overwrite, result, id);    Stat st = stat_file(destination, id);
Roxen.git/server/base_server/module.pike:1632:   //! Specifies how to handle the situation if the destination already   //! exists. See the @[Overwrite] type for details.   //!   //! @returns   //! Returns a 2xx series status mapping on success (typically 201   //! Created if the destination didn't exist before, or 204 No   //! Content otherwise). Returns 0 if the source doesn't exist.   //! Returns an appropriate status mapping for any other error. That   //! includes an empty mapping in case there's a failure on some   //! subpart or at the destination, to signify a 207 Multi-Status - //! response using the info in @[id->get_multi_status()]. + //! response using the info in @[RequestID.get_multi_status()].   mapping(string:mixed) recurse_copy_files(string source, string destination,    PropertyBehavior behavior,    Overwrite overwrite, RequestID id)   {    SIMPLE_TRACE_ENTER(this, "Recursive copy from %O to %O (%s)",    source, destination,    overwrite == DO_OVERWRITE ? "replace" :    overwrite == NEVER_OVERWRITE ? "no overwrite" :    "overlay");    string src_tmp = has_suffix(source, "/")?source:(source+"/");
Roxen.git/server/base_server/module.pike:1727:   //! Specifies how to handle the situation if the destination already   //! exists. See the @[Overwrite] type for details.   //!   //! @returns   //! Returns a 2xx series status mapping on success (typically 201   //! Created if the destination didn't exist before, or 204 No   //! Content otherwise). Returns 0 if the source doesn't exist.   //! Returns an appropriate status mapping for any other error. That   //! includes an empty mapping in case there's a failure on some   //! subpart or at the destination, to signify a 207 Multi-Status - //! response using the info in @[id->get_multi_status()]. + //! response using the info in @[RequestID.get_multi_status()].   static mapping(string:mixed) move_file(string source, string destination,    PropertyBehavior behavior,    Overwrite overwrite, RequestID id)   {    // Fall back to find_file().    RequestID tmp_id = id->clone_me();    tmp_id->not_query = query_location() + source;    tmp_id->misc["new-uri"] = query_location() + destination;    tmp_id->request_headers->destination =    id->url_base() + query_location()[1..] + destination;
Roxen.git/server/base_server/module.pike:1780:   //! Specifies how to handle the situation if the destination already   //! exists. See the @[Overwrite] type for details.   //!   //! @returns   //! Returns a 2xx series status mapping on success (typically 201   //! Created if the destination didn't exist before, or 204 No   //! Content otherwise). Returns 0 if the source doesn't exist.   //! Returns an appropriate status mapping for any other error. That   //! includes an empty mapping in case there's a failure on some   //! subpart or at the destination, to signify a 207 Multi-Status - //! response using the info in @[id->get_multi_status()]. + //! response using the info in @[RequestID.get_multi_status()].   //!   //! @note   //! The function must be prepared to recurse to check DAV locks   //! properly.   static mapping(string:mixed) move_collection(string source, string destination,    PropertyBehavior behavior,    Overwrite overwrite, RequestID id)   {    // Fall back to find_file().    RequestID tmp_id = id->clone_me();
Roxen.git/server/base_server/module.pike:1850:   //! Specifies how to handle the situation if the destination already   //! exists. See the @[Overwrite] type for details.   //!   //! @returns   //! Returns a 2xx series status mapping on success (typically 201   //! Created if the destination didn't exist before, or 204 No   //! Content otherwise). Returns 0 if the source doesn't exist.   //! Returns an appropriate status mapping for any other error. That   //! includes an empty mapping in case there's a failure on some   //! subpart or at the destination, to signify a 207 Multi-Status - //! response using the info in @[id->get_multi_status()]. + //! response using the info in @[RequestID.get_multi_status()].   mapping(string:mixed) recurse_move_files(string source, string destination,    PropertyBehavior behavior,    Overwrite overwrite, RequestID id)   {    Stat st = stat_file(source, id);    if (!st) return 0;       if (st->isdir) {    return move_collection(source, destination, behavior, overwrite, id);    }