Roxen.git / server / base_server / configuration.pike

version» Context lines:

Roxen.git/server/base_server/configuration.pike:1:   // A vitual server's main configuration   // Copyright © 1996 - 2000, Roxen IS.    - constant cvs_version = "$Id: configuration.pike,v 1.338 2000/08/15 12:45:38 jhs Exp $"; + constant cvs_version = "$Id: configuration.pike,v 1.339 2000/08/15 13:05:28 nilsson Exp $";   constant is_configuration = 1;   #include <module.h>   #include <module_constants.h>   #include <roxen.h>   #include <request_trace.h>      inherit "basic_defvar";      mapping enabled_modules = ([]);   mapping(string:array(int)) error_log=([]);
Roxen.git/server/base_server/configuration.pike:150:   /* A 'pri' is one of the ten priority objects. Each one holds a list    * of modules for that priority. They are all merged into one list for    * performance reasons later on.    */      array (Priority) allocate_pris()   {    return allocate(10, Priority)();   }    - /* For debug and statistics info only */ +    int requests; -  + //! The number of requests, for debug and statistics info only. +    // Protocol specific statistics.   mapping(string:mixed) extra_statistics = ([]);   mapping(string:mixed) misc = ([]); // Even more statistics.    - int sent; // Sent data - int hsent; // Sent headers - int received; // Received data + int sent; + //! Bytes data sent + int hsent; + //! Bytes headers sent + int received; + //! Bytes data received      // Will write a line to the log-file. This will probably be replaced   // entirely by log-modules in the future, since this would be much   // cleaner. -  +    function(string:int) log_function;    - // The logging format used. This will probably move the the above + // The logging format used. This will probably move to the above   // mentioned module in the future.   private mapping (string:string) log_format = ([]);      // A list of priority objects   private array (Priority) pri = allocate_pris();      public mapping modules = ([]);   //! All enabled modules in this virtual server.   //! The format is "module":{ "copies":([ num:instance, ... ]) }   
Roxen.git/server/base_server/configuration.pike:241:    tmp[0] = tmp2[0];    else    tmp[0]="application/octet-stream";    }    } else if(!(tmp = types_fun("default"))) {    tmp = ({ "application/octet-stream", 0 });    }    return to?tmp:tmp[0];   }    - // Return an array with all provider modules that provides "provides". +    array (RoxenModule) get_providers(string provides) -  + //! Returns an array with all provider modules that provides "provides".   { -  // FIXME: Is there any way to clear this cache? -  // /grubba 1998-05-28 -  // - Yes, it is zapped together with the rest in invalidate_cache(). +  // This cache is cleared in the invalidate_cache() call.    if(!provider_module_cache[provides])    {    int i;    provider_module_cache[provides] = ({ });    for(i = 9; i >= 0; i--)    {    foreach(indices(pri[i]->provider_modules), RoxenModule d)    if(pri[i]->provider_modules[ d ][ provides ])    provider_module_cache[provides] += ({ d });    }    }    return provider_module_cache[provides];   }    - // Return the first provider module that provides "provides". +    RoxenModule get_provider(string provides) -  + //! Returns the first provider module that provides "provides".   {    array (RoxenModule) prov = get_providers(provides);    if(sizeof(prov))    return prov[0];    return 0;   }    - // map the function "fun" over all matching provider modules. +    array(mixed) map_providers(string provides, string fun, mixed ... args) -  + //! Maps the function "fun" over all matching provider modules.   {    array (RoxenModule) prov = get_providers(provides);    array error;    array a=({ });    mixed m;    foreach(prov, RoxenModule mod)    {    if(!objectp(mod))    continue;    if(functionp(mod[fun]))
Roxen.git/server/base_server/configuration.pike:294:    error[0] = "Error in map_providers(): "+error[0];    report_debug(describe_backtrace(error));    }    else    a += ({ m });    error = 0;    }    return a;   }    - // map the function "fun" over all matching provider modules and - // return the first positive response. +    mixed call_provider(string provides, string fun, mixed ... args) -  + //! Maps the function "fun" over all matching provider modules and + //! returns the first positive response.   {    foreach(get_providers(provides), RoxenModule mod)    {    function f;    if(objectp(mod) && functionp(f = mod[fun])) {    mixed error;    if (arrayp(error = catch {    mixed ret;    if (ret = f(@args)) {    return ret;
Roxen.git/server/base_server/configuration.pike:502:   class LogFile   {    Stdio.File fd;    int opened;    string fname;    void do_open()    {    mixed parent;    if (catch { parent = function_object(object_program(this_object())); } ||    !parent) { -  /* Our parent (aka the configuration) has been destructed. -  * Time to die. -  */ +  // Our parent (aka the configuration) has been destructed. +  // Time to die.    remove_call_out(do_open);    remove_call_out(do_close);    destruct();    return;    }    string ff = fname;    mapping m = localtime(time(1)); -  m->year += 1900; /* Adjust for years being counted since 1900 */ -  m->mon++; /* Adjust for months being counted 0-11 */ +  m->year += 1900; // Adjust for years being counted since 1900 +  m->mon++; // Adjust for months being counted 0-11    if(m->mon < 10) m->mon = "0"+m->mon;    if(m->mday < 10) m->mday = "0"+m->mday;    if(m->hour < 10) m->hour = "0"+m->hour;    ff = replace(fname,({"%d","%m","%y","%h", "%H" }),    ({ (string)m->mday, (string)(m->mon),    (string)(m->year),(string)m->hour,    cached_hostname,    }));    mkdirhier( ff );    fd = open( ff, "wac" );