Roxen.git / server / base_server / configuration.pike

version» Context lines:

Roxen.git/server/base_server/configuration.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2001, Roxen IS.   //   // A site's main configuration    - constant cvs_version = "$Id: configuration.pike,v 1.452 2001/07/21 09:44:59 mast Exp $"; + constant cvs_version = "$Id: configuration.pike,v 1.453 2001/07/21 10:55:00 mast Exp $";   #include <module.h>   #include <module_constants.h>   #include <roxen.h>   #include <request_trace.h>   #include <timers.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:2289:   int(0..1) is_file(string virt_path, RequestID id)   //! Is `virt_path' a file in our virtual filesystem?   {    return !!stat_file(virt_path, id);   }      array registered_urls = ({}), failed_urls = ({ });   array do_not_log_patterns = 0;   void start(int num)   { +  fix_my_url(); +     // Note: This is run as root if roxen is started as root    foreach( (registered_urls-query("URLs"))+failed_urls, string url )    {    registered_urls -= ({ url });    roxen.unregister_url( url );    }       failed_urls = ({ });       foreach( (query( "URLs" )-registered_urls), string url )
Roxen.git/server/base_server/configuration.pike:2842:   // Called from the administration interface.   string check_variable(string name, mixed value)   {    switch(name)    {   // case "MyWorldLocation":   // if(strlen(value)<7 || value[-1] != '/' ||   // !(sscanf(value,"%*s://%*s/")==2))   // return LOCALE->url_format();   // return 0; +  case "MyWorldLocation": +  case "URLs": +  fix_my_url(); +  return 0;    case "throttle":    if (value) {    THROTTLING_DEBUG("configuration: Starting throttler up");    throttler=.throttler();    throttler->throttle(query("throttle_fill_rate"),    query("throttle_bucket_depth"),    query("throttle_min_grant"),    query("throttle_max_grant"));    } else {    if (throttler) { //check, or get a backtrace the first time it's set
Roxen.git/server/base_server/configuration.pike:3065: Inside #if ROXEN_COMPAT < 2.2
  {    if (sql_urls[db])    return sql_cache_get(sql_urls[db]);    else    return sql_cache_get(db);   }      // END SQL   #endif    - // This is the most likely URL for a site. - private string get_my_url() + static string my_url; +  + void fix_my_url()   { -  string s; - #if efun(gethostname) -  s = (gethostname()/".")[0] + "." + query("Domain"); -  s -= "\n"; - #else -  s = "localhost"; - #endif -  return "http://" + s + "/"; +  my_url = query ("MyWorldLocation"); +  if (sizeof (my_url)) { +  if (sscanf (my_url, "%s://%s/%*c", string port, string host) == 2) { +  // No subpath in MyWorldLocation; try to get one from URLs. +  foreach (query ("URLs"), string url) +  if (sscanf (url, "%*s://%*[^/]%s", url) == 3) { +  my_url = port + "://" + host + url; +  break;    } -  +  } +  } +  else +  if (!(my_url = Roxen.get_world (query ("URLs")))) +  my_url = "http://localhost/"; // Probably no port configured. +  if (!has_suffix (my_url, "/")) my_url += "/"; + }    -  + string get_url() {return my_url;} +    array after_init_hooks = ({});   mixed add_init_hook( mixed what )   {    if( inited )    call_out( what, 0, this_object() );    else    after_init_hooks |= ({ what });   }      static int got_no_delayed_load = 0;
Roxen.git/server/base_server/configuration.pike:3315:    TYPE_STRING|VAR_PUBLIC,    DLOCALE(35, "The domain name of the server. The domain name is used "    "to generate default URLs, and to generate email addresses."));       defvar("MyWorldLocation", "http://"+gethostname()+"/",    DLOCALE(36, "Primary Server URL"), TYPE_URL|VAR_PUBLIC,    DLOCALE(37, "This is the main server URL, where your start page is "    "located. Please note that you also have to configure the "    "'URLs' variable. This is for instance used as fallback to "    "generate absolute URLs to the server, but in most " -  "circumstances the URL sent by the clients are used, or " +  "circumstances the URL sent by the clients is used, or "    "the setting in 'URLs' for the port in question if that "    "doesn't exist. This setting should not contain any subpath "    "setting that is part of the port(s) in 'URLs'."));       defvar("URLs",    Variable.PortList( ({"http://*/"}), VAR_INITIAL,    DLOCALE(38, "URLs"),    DLOCALE(39, "Bind to these URLs. You can use '*' and '?' to perform"    " globbing (using any of these will default to binding to "    "all IP-numbers on your machine). The possible protocols "