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.163 2004/03/23 17:15:16 mast Exp $ + // $Id: module.pike,v 1.164 2004/04/20 21:10:15 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:280:    TRACE_LEAVE("OK");    } else {    TRACE_LEAVE("No stat info");    }    }       TRACE_LEAVE("");    return(res);   }    + class DefaultPropertySet + { +  inherit PropertySet; +  +  static mapping(string:string) response_headers; +  +  mapping(string:string) get_response_headers() +  { +  if (!response_headers) { +  // Old kludge inherited from configuration.try_get_file. +  if (!id->misc->common) +  id->misc->common = ([]); +  +  RequestID sub_id = id->clone_me(); +  sub_id->misc->common = id->misc->common; +  +  sub_id->not_query = query_location() + path; +  sub_id->raw_url = replace (id->raw_url, id->not_query, sub_id->not_query); +  sub_id->method = "HEAD"; +  +  mapping(string:mixed)|int(-1..-1)|object res = find_file (path, sub_id); +  if (res == -1) res = ([]); +  else if (objectp (res)) { +  string ext; +  if(stringp(sub_id->extension)) { +  sub_id->not_query += sub_id->extension; +  ext = lower_case(Roxen.extension(sub_id->not_query, sub_id)); +  } +  array(string) tmp=sub_id->conf->type_from_filename(sub_id->not_query, 1, ext); +  if(tmp) +  res = ([ "file":res, "type":tmp[0], "encoding":tmp[1] ]); +  else +  res = (["file": res]); +  } +  response_headers = sub_id->make_response_headers (res); +  destruct (sub_id); +  } +  +  return response_headers; +  } + } +    //! Return the set of properties for @[path].   //!   //! @returns   //! Returns @tt{0@} (zero) if @[path] does not exist.   //!   //! Returns an error mapping if there's some other error accessing   //! the properties.   //!   //! Otherwise returns a @[PropertySet] object.   PropertySet|mapping(string:mixed) query_properties(string path, RequestID id)   {    SIMPLE_TRACE_ENTER (this, "Querying properties on %O", path);    Stat st = stat_file(path, id);       if (!st) {    SIMPLE_TRACE_LEAVE ("No such file or dir");    return 0;    }    -  PropertySet res = PropertySet(path, st, id); +  PropertySet res = DefaultPropertySet(path, st, id);    SIMPLE_TRACE_LEAVE ("");    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
Roxen.git/server/base_server/module.pike:518:   //!   //! @note   //! Should return a 204 status on success.   //!   //! @note   //! The default implementation falls back to @[find_file()].   mapping(string:mixed) delete_file(string path, RequestID id)   {    // Fall back to find_file().    RequestID tmp_id = id->close_me(); -  tmp_id->not_query = query_location() + "/" + path; +  tmp_id->not_query = query_location() + path;    tmp_id->method = "DELELE";    // FIXME: Logging?    return find_file(path, id) || Roxen.http_status(404);   }      int(0..1) recurse_delete_files(string path, MultiStatus stat, RequestID id)   {    Stat st = stat_file(path, id);    if (!st) return 0;    if (st->isdir) {