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.   //   // German translation by Kai Voigt    - constant cvs_version = "$Id: configuration.pike,v 1.319 2000/07/10 22:41:24 nilsson Exp $"; + constant cvs_version = "$Id: configuration.pike,v 1.320 2000/07/11 01:49:54 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=([]);      #ifdef PROFILE   mapping profile_map = ([]);   #endif      #define CATCH(P,X) do{mixed e;if(e=catch{X;})report_error("While "+P+"\n"+describe_backtrace(e));}while(0)      // Locale support...   //<locale-token project="base_server">LOCALE</locale-token> -  + #define LOCALE(X,Y) _STR_LOCALE(base_server,X,Y) + LOCALE_PROJECT(base_server); + #define DLOCALE(X,Y) _DEF_LOCALE(X,Y)    - #if constant(Locale.translate) - # define LOCALE(X,Y) Locale.translate(roxen.locale->get()->base_server, X, Y) - #else - # define LOCALE(X,Y) RoxenLocale.translate(roxen.locale->get()->base_server, X, Y) - #endif -  +    #ifdef THROTTLING_DEBUG   #undef THROTTLING_DEBUG   #define THROTTLING_DEBUG(X) werror("Throttling: "+X+"\n")   #else   #define THROTTLING_DEBUG(X)   #endif      #ifdef REQUEST_DEBUG   # define REQUEST_WERR(X) werror("CONFIG: "+X+"\n")   #else
Roxen.git/server/base_server/configuration.pike:2364:       module_type = moduleinfo->type;    if (module_type & (MODULE_LOCATION|MODULE_EXTENSION|    MODULE_CONFIG|MODULE_FILE_EXTENSION|MODULE_LOGGER|    MODULE_URL|MODULE_LAST|MODULE_PROVIDER|    MODULE_FILTER|MODULE_PARSER|MODULE_FIRST))    {    if(module_type != MODULE_CONFIG)    {    if (err = catch { -  me->defvar("_priority", 5, LOCALE("", "Priority"), TYPE_INT_LIST, -  LOCALE("", "The priority of the module. 9 is highest and 0 is lowest." +  me->defvar("_priority", 5, DLOCALE("", "Priority"), TYPE_INT_LIST, +  DLOCALE("", "The priority of the module. 9 is highest and 0 is lowest."    " Modules with the same priority can be assumed to be "    "called in random order"),    ({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}));    }) {    throw(err);    }    }       if(module_type != MODULE_LOGGER && module_type != MODULE_PROVIDER)    {    if(!(module_type & MODULE_PROXY))    { -  me->defvar("_sec_group", "user", LOCALE("", "Security: Realm"), TYPE_STRING, -  LOCALE("", "The realm to use when requesting password from the " +  me->defvar("_sec_group", "user", DLOCALE("", "Security: Realm"), TYPE_STRING, +  DLOCALE("", "The realm to use when requesting password from the "    "client. Usually used as an informative message to the "    "user."));    -  me->defvar("_seclvl", 0, LOCALE("", "Security: Security level"), TYPE_INT, -  LOCALE("", "The modules security level is used to determine if a " +  me->defvar("_seclvl", 0, DLOCALE("", "Security: Security level"), TYPE_INT, +  DLOCALE("", "The modules security level is used to determine if a "    " request should be handled by the module."    "\n<p><h2>Security level vs Trust level</h2>"    " Each module has a configurable <i>security level</i>."    " Each request has an assigned trust level. Higher"    " <i>trust levels</i> grants access to modules with higher"    " <i>security levels</i>."    "\n<p><h2>Definitions</h2><ul>"    " <li>A requests initial Trust level is infinitely high.</li>"    " <li> A request will only be handled by a module if its"    " <i>trust level</i> is higher or equal to the"
Roxen.git/server/base_server/configuration.pike:2417:    "\n<p>A request handled by \"User filesystem\" is assigned"    " a <i>trust level</i> of one after the <i>security"    " level</i> of that module. That request can then not be"    " handled by the \"CGI module\" since that module has a"    " higher <i>security level</i> than the requests trust"    " level.</p>"    "\n<p>On the other hand, a request handled by the the"    " \"Filsystem module\" could later be handled by the"    " \"CGI module\".</p>"));    -  me->defvar("_seclevels", "", LOCALE("", "Security: Patterns"), TYPE_TEXT_FIELD, -  LOCALE("", "This is the 'security level=value' list.<br />" +  me->defvar("_seclevels", "", DLOCALE("", "Security: Patterns"), TYPE_TEXT_FIELD, +  DLOCALE("", "This is the 'security level=value' list.<br />"    "Each security level can be any or more from this list:"    "<hr noshade=\"noshade\" />"    "allow ip=<i>IP</i>/<i>bits</i><br />"    "allow ip=<i>IP</i>:<i>mask</i><br />"    "allow ip=<i>pattern</i><br />"    "allow user=<i>username</i>,...<br />"    "deny ip=<i>IP</i>/<i>bits</i><br />"    "deny ip=<i>IP</i>:<i>mask</i><br />"    "deny ip=<i>pattern</i><br />"    "<hr noshade=\"noshade\" />"    "In patterns: * matches one or more characters, "    "and ? matches one character."    "<p>In username: 'any' stands for any valid account "    "(from .htaccess"    " or an auth module. The default (used when _no_ "    "entries are present) is 'allow ip=*', allowing"    " everyone to access the module.</p>"));    } else {    me->definvisvar("_seclvl", -10, TYPE_INT); /* A very low one */    -  me->defvar("_sec_group", "user", LOCALE("", "Security: Realm"), TYPE_STRING, -  LOCALE("", "The realm to use when requesting password from the " +  me->defvar("_sec_group", "user", DLOCALE("", "Security: Realm"), TYPE_STRING, +  DLOCALE("", "The realm to use when requesting password from the "    "client. Usually used as an informative message to the "    "user."));    -  me->defvar("_seclevels", "", LOCALE("", "Security: Patterns"), +  me->defvar("_seclevels", "", DLOCALE("", "Security: Patterns"),    TYPE_TEXT_FIELD, -  LOCALE("", "This is the 'security level=value' list.<br />" +  DLOCALE("", "This is the 'security level=value' list.<br />"    "Each security level can be any or more from "    "this list:<br />"    "<hr noshade=\"noshade\" />"    "allow ip=pattern<br />"    "allow user=username,...<br />"    "deny ip=pattern<br />"    "<hr noshade=\"noshade\" />"    "In patterns: * is on or more characters, ? is one "    " character."    "<p>In username: 'any' stands for any valid account"
Roxen.git/server/base_server/configuration.pike:2947:       inited = 1;    report_notice("All modules for %s enabled in %3.1f seconds\n\n",    query_name(),(gethrtime()-start_time)/1000000.0);   }      void create(string config)   {    name=config;    -  defvar("default_server", 0, LOCALE("", "Default site"), +  defvar("default_server", 0, DLOCALE("", "Default site"),    TYPE_FLAG, -  LOCALE("", "If true, this site will be selected in preference of " +  DLOCALE("", "If true, this site will be selected in preference of "    "other sites when virtual hosting is used and no host "    "header is supplied, or the supplied host header does not "    "match the address of any of the other servers.") );    -  defvar("comment", "", LOCALE("", "Virtual server comment"), +  defvar("comment", "", DLOCALE("", "Virtual server comment"),    TYPE_TEXT_FIELD|VAR_MORE, -  LOCALE("", "This text will be visible in the administration interface, it " +  DLOCALE("", "This text will be visible in the administration interface, it "    " can be quite useful to use as a memory helper."));    -  defvar("name", "", LOCALE("", "Virtual server name"), +  defvar("name", "", DLOCALE("", "Virtual server name"),    TYPE_STRING|VAR_MORE, -  LOCALE("", "This is the name that will be used in the configuration " +  DLOCALE("", "This is the name that will be used in the configuration "    "interface. If this is left empty, the actual name of the "    "virtual server will be used."));       defvar("LogFormat",    "404: $host $referer - [$cern_date] \"$method $resource $protocol\" 404 -\n"    "500: $host $referer ERROR [$cern_date] \"$method $resource $protocol\" 500 -\n"    "*: $host - - [$cern_date] \"$method $resource $protocol\" $response $length", -  LOCALE("", "Logging: Format"), +  DLOCALE("", "Logging: Format"),    TYPE_TEXT_FIELD|VAR_MORE,    -  LOCALE("", "What format to use for logging. The syntax is:\n" +  DLOCALE("", "What format to use for logging. The syntax is:\n"    "<pre>"    "response-code or *: Log format for that response acode\n\n"    "Log format is normal characters, or one or more of the "    "variables below:\n"    "\n"    "\\n \\t \\r -- As in C, newline, tab and linefeed\n"    "$char(int) -- Insert the (1 byte) character specified by the integer.\n"    "$wchar(int) -- Insert the (2 byte) word specified by the integer.\n"    "$int(int) -- Insert the (4 byte) word specified by the integer.\n"    "$^ -- Supress newline at the end of the logentry\n"
Roxen.git/server/base_server/configuration.pike:3006:    "$length -- The length of the data section of the reply\n"    "$bin-length -- Same, but as an 32 bit iteger in network byteorder\n"    "$request-time -- The time the request took (seconds)\n"    "$referer -- the header 'referer' from the request, or '-'.\n"    "$user_agent -- the header 'User-Agent' from the request, or '-'.\n\n"    "$user -- the name of the auth user used, if any\n"    "$user_id -- A unique user ID, if cookies are supported,\n"    " by the client, otherwise '0'\n"    "</pre>"), 0, lambda(){ return !query("Log");});    -  defvar("Log", 1, LOCALE("", "Logging: Enabled"), TYPE_FLAG, LOCALE("", "Log requests")); +  defvar("Log", 1, DLOCALE("", "Logging: Enabled"), TYPE_FLAG, DLOCALE("", "Log requests"));       // FIXME: Mention it is relative to getcwd(). Can not be localized in pike 7.0.    defvar("LogFile", "$LOGDIR/"+Roxen.short_name(name)+"/Log", -  LOCALE("", "Logging: Log file"), TYPE_FILE, -  LOCALE("", "The log file. " +  DLOCALE("", "Logging: Log file"), TYPE_FILE, +  DLOCALE("", "The log file. "    ""    "A file name. Some substitutions will be done:"    "<pre>"    "%y Year (e.g. '1997')\n"    "%m Month (e.g. '08')\n"    "%d Date (e.g. '10' for the tenth)\n"    "%h Hour (e.g. '00')\n"    "%H Hostname\n"    "</pre>")    ,0, lambda(){ return !query("Log");});       defvar("NoLog", ({ }), -  LOCALE("", "Logging: No Logging for"), TYPE_STRING_LIST|VAR_MORE, -  LOCALE("", "Don't log requests from hosts with an IP number which matches any " +  DLOCALE("", "Logging: No Logging for"), TYPE_STRING_LIST|VAR_MORE, +  DLOCALE("", "Don't log requests from hosts with an IP number which matches any "    "of the patterns in this list. This also affects the access counter "    "log."), 0, lambda(){ return !query("Log");});    -  defvar("Domain", roxen->get_domain(), LOCALE("", "Domain"), TYPE_STRING, -  LOCALE("", "The domainname of the server. The domainname is used " +  defvar("Domain", roxen->get_domain(), DLOCALE("", "Domain"), TYPE_STRING, +  DLOCALE("", "The domainname of the server. The domainname is used "    " to generate default URLs, and to gererate email addresses."));       defvar("MyWorldLocation", "http://"+gethostname()+"/", -  LOCALE("", "Primary Server URL"), TYPE_URL, -  LOCALE("", "This is the main server URL, where your start page is located. " +  DLOCALE("", "Primary Server URL"), TYPE_URL, +  DLOCALE("", "This is the main server URL, where your start page is located. "    "Please note that you also have to configure the 'URLs' variable."));       defvar("URLs",    Variable.PortList( ({"http://*/"}), VAR_INITIAL, -  LOCALE("", "URLs"), -  LOCALE("", "Bind to these URLs. You can use '*' and '?' to perform globbing " +  DLOCALE("", "URLs"), +  DLOCALE("", "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 are http, fhttp (a faster "    "version of the normal HTTP protocol, but not 100% compatible with "    "all modules) https, ftp, ftps, gopher and tetris.")));       defvar("InternalLoc", "/_internal/", -  LOCALE("", "Internal module resource mountpoint"), +  DLOCALE("", "Internal module resource mountpoint"),    TYPE_LOCATION|VAR_MORE|VAR_DEVELOPER, -  LOCALE("", "Some modules may want to create links to internal resources. " +  DLOCALE("", "Some modules may want to create links to internal resources. "    "This setting configures an internally handled location that can "    "be used for such purposes. Simply select a location that you are "    "not likely to use for regular resources."));          // Throttling-related variables       defvar("throttle", 0, -  LOCALE("", "Bandwidth Throttling: Server: Enabled"),TYPE_FLAG, -  LOCALE("", "If set, per-server bandwidth throttling will be enabled. " +  DLOCALE("", "Bandwidth Throttling: Server: Enabled"),TYPE_FLAG, +  DLOCALE("", "If set, per-server bandwidth throttling will be enabled. "    "It will allow you to limit the total available bandwidth for "    "this Virtual Server.<br />Bandwidth is assigned using a Token Bucket. "    "The principle under which it works is: for each byte we send we use a token. "    "Tokens are added to a repository at a constant rate. When there's not enough, "    "we can't transmit. When there's too many, they \"spill\" and are lost."));    //TODO: move this explanation somewhere on the website and just put a link.       defvar("throttle_fill_rate", 102400, -  LOCALE("", "Bandwidth Throttling: Server: Average available bandwidth"), +  DLOCALE("", "Bandwidth Throttling: Server: Average available bandwidth"),    TYPE_INT, -  LOCALE("", "This is the average bandwidth available to this Virtual Server in " +  DLOCALE("", "This is the average bandwidth available to this Virtual Server in "    "bytes/sec (the bucket \"fill rate\")."),    0, arent_we_throttling_server);       defvar("throttle_bucket_depth", 1024000, -  LOCALE("", "Bandwidth Throttling: Server: Bucket Depth"), TYPE_INT, -  LOCALE("", "This is the maximum depth of the bucket. After a long enough period " +  DLOCALE("", "Bandwidth Throttling: Server: Bucket Depth"), TYPE_INT, +  DLOCALE("", "This is the maximum depth of the bucket. After a long enough period "    "of inactivity, a request will get this many unthrottled bytes of data, before "    "throttling kicks back in.<br>Set equal to the Fill Rate in order not to allow "    "any data bursts. This value determines the length of the time over which the "    "bandwidth is averaged."), 0, arent_we_throttling_server);       defvar("throttle_min_grant", 1300, -  LOCALE("", "Bandwidth Throttling: Server: Minimum Grant"), TYPE_INT, -  LOCALE("", "When the bandwidth availability is below this value, connections will " +  DLOCALE("", "Bandwidth Throttling: Server: Minimum Grant"), TYPE_INT, +  DLOCALE("", "When the bandwidth availability is below this value, connections will "    "be delayed rather than granted minimal amounts of bandwidth. The purpose "    "is to avoid sending too small packets (which would increase the IP overhead)."),    0, arent_we_throttling_server);       defvar("throttle_max_grant", 14900, -  LOCALE("", "Bandwidth Throttling: Server: Maximum Grant"), TYPE_INT, -  LOCALE("", "This is the maximum number of bytes assigned in a single request " +  DLOCALE("", "Bandwidth Throttling: Server: Maximum Grant"), TYPE_INT, +  DLOCALE("", "This is the maximum number of bytes assigned in a single request "    "to a connection. Keeping this number low will share bandwidth more evenly "    "among the pending connections, but keeping it too low will increase IP "    "overhead and (marginally) CPU usage. You'll want to set it just a tiny "    "bit lower than any integer multiple of your network's MTU (typically 1500 "    "for ethernet)."), 0, arent_we_throttling_server);       defvar("req_throttle", 0, -  LOCALE("", "Bandwidth Throttling: Request: Enabled"), TYPE_FLAG, -  LOCALE("", "If set, per-request bandwidth throttling will be enabled.") +  DLOCALE("", "Bandwidth Throttling: Request: Enabled"), TYPE_FLAG, +  DLOCALE("", "If set, per-request bandwidth throttling will be enabled.")    );       defvar("req_throttle_min", 1024, -  LOCALE("", "Bandwidth Throttling: Request: Minimum guarranteed bandwidth"), +  DLOCALE("", "Bandwidth Throttling: Request: Minimum guarranteed bandwidth"),    TYPE_INT, -  LOCALE("", "The maximum bandwidth each connection (in bytes/sec) can use is determined " +  DLOCALE("", "The maximum bandwidth each connection (in bytes/sec) can use is determined "    "combining a number of modules. But doing so can lead to too small "    "or even negative bandwidths for particularly unlucky requests. This variable "    "guarantees a minimum bandwidth for each request."),    0, arent_we_throttling_request);       defvar("req_throttle_depth_mult", 60.0, -  LOCALE("", "Bandwidth Throttling: Request: Bucket Depth Multiplier"), +  DLOCALE("", "Bandwidth Throttling: Request: Bucket Depth Multiplier"),    TYPE_FLOAT, -  LOCALE("", "The average bandwidth available for each request will be determined by " +  DLOCALE("", "The average bandwidth available for each request will be determined by "    "the modules combination. The bucket depth will be determined multiplying "    "the rate by this factor."),    0, arent_we_throttling_request);       defvar("ZNoSuchFile", #"   <html><head>   <title>404 - Page not found</title>   </head>      <body alink=\"#000000\" bgcolor=\"#ffffff\" bottommargin=\"0\" leftmargin=\"0\" link=\"#ce5c00\" marginheight=\"2\" marginwidth=\"0\" rightmargin=\"0\" text=\"#333333\" topmargin=\"2\" vlink=\"#ce5c00\">
Roxen.git/server/base_server/configuration.pike:3158:   <a href=\"&client.referrer;\">referring</a>   </if><else>   referring   </else>   page.      </blockquote>   </font>   </body>   ", -  LOCALE("", "Messages: No such file"),TYPE_TEXT_FIELD, -  LOCALE("", "What to return when there is no resource or file available " +  DLOCALE("", "Messages: No such file"),TYPE_TEXT_FIELD, +  DLOCALE("", "What to return when there is no resource or file available "    "at a certain location."));       definvisvar( "no_delayed_load", 0, TYPE_FLAG );       setvars( retrieve("spider#0", this_object()) );       if (query("throttle"))    {    throttler=.throttler();    throttler->throttle(query("throttle_fill_rate"),