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.408 2001/01/13 17:43:28 nilsson Exp $"; + constant cvs_version = "$Id: configuration.pike,v 1.409 2001/01/19 12:41:32 per Exp $";   #include <module.h>   #include <module_constants.h>   #include <roxen.h>   #include <request_trace.h>         #define CATCH(P,X) do{mixed e;if(e=catch{X;})report_error("While "+P+"\n"+describe_backtrace(e));}while(0)      // --- Locale defines ---   //<locale-token project="roxen_start"> LOC_S </locale-token>
Roxen.git/server/base_server/configuration.pike:632:    else    return 0;    // File not found.   }      private static int nest = 0;      #ifdef MODULE_LEVEL_SECURITY   private mapping misc_cache=([]);    - int|mapping check_security(function|object a, RequestID id, void|int slevel) + int|mapping check_security(function|RoxenModule a, RequestID id, +  void|int slevel)   {    array level;    array seclevels;    int ip_ok = 0; // Unknown    int auth_ok = 0; // Unknown    // NOTE:    // ip_ok and auth_ok are three-state variables.    // Valid contents for them are:    // 0 Unknown state -- No such restriction encountered yet.    // 1 May be bad -- Restriction encountered, and test failed.    // ~0 OK -- Test passed.       if(!(seclevels = misc_cache[ a ])) { -  object mod = Roxen.get_owning_module (a); +  RoxenModule mod = Roxen.get_owning_module (a);    if(mod && mod->query_seclevels)    misc_cache[ a ] = seclevels = ({    mod->query_seclevels(),    mod->query("_seclvl"),    mod->query("_sec_group")    });    else    {    misc_cache[ a ] = seclevels = ({({}),0,"foo" });    }
Roxen.git/server/base_server/configuration.pike:856:      mapping (mixed:function|int) locks = ([]);      #ifdef THREADS   // import Thread;      mapping locked = ([]), thread_safe = ([]);      mixed _lock(object|function f)   { -  object key; +  Thread.MutexKey key;    function|int l;       if (functionp(f)) {    f = function_object(f);    }    if (l = locks[f])    {    if (l != -1)    {    // Allow recursive locks.
Roxen.git/server/base_server/configuration.pike:980:   //!   //! The return values 0 (no such file) and -1 (the data is a   //! directory) are only returned when `no_magic' was set to 1;   //! otherwise a result mapping is always generated.   {   #ifdef MODULE_LEVEL_SECURITY    int slevel;   #endif      #ifdef THREADS -  object key; +  Thread.MutexKey key;   #endif    TRACE_ENTER(sprintf("Request for %s", id->not_query), 0);       string file=id->not_query;    string loc;    function funp;    mixed tmp, tmp2;    mapping|object(Stdio.File)|int fid;       if(!no_magic)
Roxen.git/server/base_server/configuration.pike:1383:   array(string) find_dir(string file, RequestID id, void|int(0..1) verbose)   {    array dir;    TRACE_ENTER(sprintf("List directory %O.", file), 0);       if(!sizeof (file) || file[0] != '/')    file = "/" + file;      #ifdef URL_MODULES   #ifdef THREADS -  object key; +  Thread.MutexKey key;   #endif    // Map URL-modules    foreach(url_modules(), function funp)    {    string of = id->not_query;    id->not_query = file;    LOCK(funp);    TRACE_ENTER("URL module", funp); -  void|mapping|object remap=funp( id, file ); +  mixed remap=funp( id, file );    UNLOCK();       if(mappingp( remap ))    {    id->not_query=of;    TRACE_LEAVE("Returned 'No thanks'.");    TRACE_LEAVE("");    return 0;    }    if(objectp( remap ))
Roxen.git/server/base_server/configuration.pike:1426: Inside #if defined(URL_MODULES)
   nest = 0;    TRACE_LEAVE("");    if(err)    throw(err);    return dir;    }    id->not_query=of;    }   #endif /* URL_MODULES */    -  array(string) | mapping d; +  array | mapping d;    array(string) locks=({}); -  object mod; +  RoxenModule mod;    string loc;    foreach(location_modules(), array tmp)    {    loc = tmp[0];    if(!search(file, loc)) {    /* file == loc + subpath */    TRACE_ENTER(sprintf("Location module [%s] ", loc), tmp[1]);   #ifdef MODULE_LEVEL_SECURITY    if(check_security(tmp[1], id)) {    TRACE_LEAVE("Permission denied");
Roxen.git/server/base_server/configuration.pike:1498:    return 0;   }      // Stat a virtual file.      array(int)|Stat stat_file(string file, RequestID id)   {    string loc;    mixed s, tmp;   #ifdef THREADS -  object key; +  Thread.MutexKey key;   #endif    TRACE_ENTER(sprintf("Stat file %O.", file), 0);       file=replace(file, "//", "/"); // "//" is really "/" here...      #ifdef URL_MODULES    // Map URL-modules    foreach(url_modules(), function funp)    {    string of = id->not_query;
Roxen.git/server/base_server/configuration.pike:1599:    id->misc->defines = ([ " _error":404 ]);    return Roxen.http_rxml_answer( data, id, 0, "text/html" );   }      // this is not as trivial as it sounds. Consider gtext. :-)   array open_file(string fname, string mode, RequestID id, void|int internal_get)   {    if( id->conf && (id->conf != this_object()) )    return id->conf->open_file( fname, mode, id, internal_get );    -  object oc = id->conf; +  Configuration oc = id->conf;    string oq = id->not_query;    function funp;    mapping|int(0..1) file;       id->not_query = fname;       foreach(first_modules(), funp)    if(file = funp( id ))    break;    else if(id->conf && (id->conf != oc))
Roxen.git/server/base_server/configuration.pike:1687:       if(!sizeof (file) || file[0] != '/')    file = "/" + file;       // FIXME: Should I append a "/" to file if missing?       TRACE_ENTER(sprintf("Request for directory and stat's \"%s\".", file), 0);      #ifdef URL_MODULES   #ifdef THREADS -  object key; +  Thread.MutexKey key;   #endif    // Map URL-modules    foreach(url_modules(), function funp)    {    string of = id->not_query;    id->not_query = file;    LOCK(funp);    TRACE_ENTER("URL module", funp);    tmp=funp( id, file );    UNLOCK();
Roxen.git/server/base_server/configuration.pike:2758:    return; // already done       int start_time = gethrtime();    if (!modules_already_enabled)    report_debug("\nEnabling all modules for "+query_name()+"... \n");       add_parse_module( (object)this_object() );       if (!modules_already_enabled) {    enabled_modules = retrieve("EnabledModules", this_object()); -  object ec = roxenloader.LowErrorContainer(); +  roxenloader.LowErrorContainer ec = roxenloader.LowErrorContainer();    roxenloader.push_compile_error_handler( ec );       array modules_to_process = indices( enabled_modules );    string tmp_string;       // Always enable the user database module first.    if(search(modules_to_process, "userdb#0")>-1)    modules_to_process = (({"userdb#0"})+(modules_to_process-({"userdb#0"})));       array err;
Roxen.git/server/base_server/configuration.pike:2788:    }    }    enable_module_batch_msgs = 0;    roxenloader.pop_compile_error_handler();    if( strlen( ec->get() ) )    report_error( "While enabling modules in "+name+":\n"+ec->get() );    if( strlen( ec->get_warnings() ) )    report_warning( "While enabling modules in "+name+":\n"+ec->get_warnings());    }    -  foreach( ({this_object()})+indices( otomod ), object mod ) +  foreach( ({this_object()})+indices( otomod ), RoxenModule mod )    if( mod->ready_to_receive_requests )    if( mixed q = catch( mod->ready_to_receive_requests( this_object() ) ) ) {    report_error( "While calling ready_to_receive_requests in "+    otomod[mod]+":\n"+    describe_backtrace( q ) );    got_no_delayed_load = -1;    }       foreach( after_init_hooks, function q )    if( mixed w = catch( q(this_object()) ) ) {