Roxen.git / server / base_server / global_variables.pike

version» Context lines:

Roxen.git/server/base_server/global_variables.pike:1:   // This file is part of Roxen Webserver.   // Copyright © 1996 - 2000, Roxen IS. - // $Id: global_variables.pike,v 1.24 2000/03/06 18:54:30 nilsson Exp $ + // $Id: global_variables.pike,v 1.25 2000/03/10 02:15:08 nilsson Exp $    -  + #pragma strict_types + #define DEFVAR string,int|string,string|mapping,int,string|mapping(string:string),void|array(string),void|function:void + #define BDEFVAR string,int|string,string|mapping,int,string|mapping(string:string),void|array(string),void|mapping(string:mapping(string:string)):void +    #include <module.h>   #include <roxen.h>   #include <config.h>   inherit "read_config";   inherit "module_support";   #include <version.h>      // The following three functions are used to hide variables when they   // are not used. This makes the user-interface clearer and quite a lot   // less clobbered.      private int cache_disabled_p() { return !QUERY(cache); }   private int syslog_disabled() { return QUERY(LogA)!="syslog"; } - private int ident_disabled_p() { return QUERY(default_ident); } + private int ident_disabled_p() { return [int(0..1)]QUERY(default_ident); }         // And why put these functions here, you might rightully ask.      // The answer is that there is actually a reason for it, it's for   // performance reasons. This file is dumped to a .o file, roxen.pike   // is not.         void set_up_ftp_variables( object o )   { -  function defvar = o->defvar; +  function(DEFVAR) defvar = +  [function(DEFVAR)] o->defvar;          defvar( "FTPWelcome",    " +------------------------------------------------\n"    " +-- Welcome to the Roxen FTP server ---\n"    " +------------------------------------------------\n",    "Welcome text",TYPE_TEXT,    "The text shown the the user on connect" );       defvar( "ftp_user_session_limit", 0, "User session limit", TYPE_INT,
Roxen.git/server/base_server/global_variables.pike:55:    defvar( "shells", "", "Shell database", TYPE_FILE,    "If this string is set to anything but the empty string, "    "it should point to a file containing a list of valid shells. "    "Users with shells that does not figure in this list will not "    "be allowed to log in." );   }         void set_up_http_variables( object o, int|void fhttp )   { -  function defvar = o->defvar; -  function deflocaledoc = o->deflocaledoc; +  function(DEFVAR) defvar = +  [function(DEFVAR)] o->defvar; +  function(string,string,string,string:void) deflocaledoc = +  [function(string,string,string,string:void)] o->deflocaledoc;       defvar("show_internals", 1, "Show internal errors", TYPE_FLAG,   #"Show 'Internal server error' messages to the user.   This is very useful if you are debugging your own modules   or writing Pike scripts.");       deflocaledoc( "svenska", "show_internals", "Visa interna fel",    #"Visa interna server fel för användaren av servern.   Det är väldigt användbart när du utvecklar egna moduler eller pikeskript.");    deflocaledoc( "deutsch", "show_internals", "Anzeige von internen Fehlern",
Roxen.git/server/base_server/global_variables.pike:115:    deflocaledoc( "deutsch", "set_cookie_only_once",    "Logging: Benutzer-Cookie nur einmal setzen",   #"Dem Benutzer wird nur beim ersten Aufruf ein eindeutiger Benutzer-Cookie   geschickt. Dadurch wird der Benutzer nur einmal aufgefordert, einen Cookie   anzunehmen.");    }   }      void set_up_fhttp_variables( object o )   { -  function defvar = o->defvar; -  function deflocaledoc = o->deflocaledoc; +  function(BDEFVAR) defvar = +  [function(BDEFVAR)] o->defvar; +  function(string,string,string,string:void) deflocaledoc = +  [function(string,string,string,string:void)] o->deflocaledoc;       defvar( "log", "None", -  +  [mapping(string:string)]    (["standard":"Logging method",    "svenska":"Loggmetod",    "deutsch": "Logging-Methode", ]), TYPE_STRING_LIST,    (["standard": -  "None - No log<br>" -  "CommonLog - A common log in a file<br>" -  "Compat - Log though roxen's normal logging format.<br>" +  "None - No log<br />" +  "CommonLog - A common log in a file<br />" +  "Compat - Log though roxen's normal logging format.<br />"    "<p>Please note that compat limits roxen to less than 1k " -  "requests/second.", +  "requests/second.</p>",    "svenska": -  "Ingen - Logga inte alls<br>" -  "Commonlog - Logga i en commonlogfil<br>" +  "Ingen - Logga inte alls<br />" +  "Commonlog - Logga i en commonlogfil<br />"    "Kompatibelt - Logga som vanligt. Notera att det inte går "    "speciellt fort att logga med den här metoden, det begränsar "    "roxens hastighet till strax under 1000 requests/sekund på "    "en normalsnabb dator år 1999.",    "deutsch": -  "Keine - Kein Logfile<br>" -  "CommonLog - Logging nach dem CommonLog-Format<br>" -  "Compat - Mit Roxen's normalem Format arbeiten.<br>" +  "Keine - Kein Logfile<br />" +  "CommonLog - Logging nach dem CommonLog-Format<br />" +  "Compat - Mit Roxen's normalem Format arbeiten.<br />"    "<p>Hinweis: Die Compat-Methode beschränkt Roxen auf "    "1000 Zugriffe/Sekunde.",    ]),    ({ "None", "CommonLog", "Compat" }),    ([ "svenska":    ([    "None":"Ingen",    "CommonLog":"Commonlog",    "Compat":"Kompatibel",    ]),    "deutsch":    ([    "None":"Keine",    "CommonLog":"CommonLog",    "Compat":"Compat",    ]),    ]) );    -  defvar( "log_file", "../logs/clog-"+o->ip+":"+o->port, +  defvar( "log_file", "../logs/clog-"+[string]o->ip+":"+[string]o->port,    ([ "standard":"Log file",    "svenska":"Logfil",    "deutsch":"Logdatei", ]), TYPE_FILE,    ([ "svenska":"Den här filen används om man loggar med "    " commonlog metoden.",    "standard":"This file is used if logging is done using the "    "CommonLog method.",    "deutsch":"Diese Datei wird zum Logging im CommonLog-Format "    "benutzt."    ]));
Roxen.git/server/base_server/global_variables.pike:195:    "deutsch":"Die maximale Zeit in Sekunden, die Roxen wartet, "    "bevor die Verbindung zum Client abgebrochen wird" ]) );          set_up_http_variables( o,1 );      }      void set_up_ssl_variables( object o )   { -  function defvar = o->defvar; -  function deflocaledoc = o->deflocaledoc; +  function(DEFVAR) defvar = +  [function(DEFVAR)] o->defvar; +  function(string,string,string,string:void) deflocaledoc = +  [function(string,string,string,string:void)] o->deflocaledoc;       defvar( "ssl_cert_file", "demo_certificate.pem",    ([    "standard":"SSL certificate file",    "svenska":"SSL-certifikatsfil",    "deutsch":"SSL-Zertifikatsdatei"    ]), TYPE_STRING,    ([    "standard":"The SSL certificate file to use. The path "    "is relative to "+getcwd()+"\n",
Roxen.git/server/base_server/global_variables.pike:551:    deflocaledoc("deutsch", "pidfile", "PID-Datei",    "In dieser Datei legt der Server seine eigene PID und die "    "des start-Scripts ablegen. $pid wird mit der PID ersetzt "    "und $uid mit der UID des ausführenden Benutzers.");       globvar("default_ident", 1, "Identify, Use default identification string",    TYPE_FLAG|VAR_MORE,    "Setting this variable to No will display the \"Identify as\" node "    "where you can state what Roxen should call itself when talking "    "to clients, otherwise it will present it self as \""+ real_version -  +"\".<br>" +  +"\".<br />"    "It is possible to disable this so that you can enter an "    "identification-string that does not include the actual version of "    "Roxen, as recommended by the HTTP/1.0 draft 03:<p><blockquote><i>"    "Note: Revealing the specific software version of the server "    "may allow the server machine to become more vulnerable to "    "attacks against software that is known to contain security "    "holes. Server implementors are encouraged to make this field "    "a configurable option.</i></blockquote>");    deflocaledoc("svenska", "default_ident", "Identifiera roxen med "    "normala identitetssträngen",
Roxen.git/server/base_server/global_variables.pike:669:    modul ska laddas. Directorynamnen kan vara relativa från "+getcwd()+   ", och de kommer att sökas igenom i den ordning som de står i listan.");    deflocaledoc("deutsch", "ModuleDirs", "Modul-Verzeichnisse",   #"Eine Liste von Verzeichnissen, in denen Roxen nach Modulen   suchen wird. Dies können relative Pfade zu "+getcwd()+#" sein.   Die Verzeichnisse werden in der eingegeben Reihenfolge nach Modulen   durchsucht.");       globvar("Supports", "#include <etc/supports>\n",    "Client supports regexps", TYPE_TEXT_FIELD|VAR_MORE, -  "What do the different clients support?\n<br>" +  "What do the different clients support?\n<br />"    "The default information is normally fetched from the file "+    getcwd()+"etc/supports, and the format is:<pre>"    "regular-expression"    " feature, -feature, ...\n"    "</pre>"    "If '-' is prepended to the name of the feature, it will be removed"    " from the list of features of that client. All patterns that match"    " each given client-name are combined to form the final feature list"    ". See the file etc/supports for examples.");    deflocaledoc("svenska", "Supports",
Roxen.git/server/base_server/global_variables.pike:762:    ({ "Daemon", "Local 0", "Local 1", "Local 2", "Local 3",    "Local 4", "Local 5", "Local 6", "Local 7", "User" }),    syslog_disabled);    deflocaledoc( "svenska", "LogST", "Loggning: Systemloggningstyp",    "När systemloggen används, vilken loggningstyp ska "    "roxen använda?");    deflocaledoc( "deutsch", "LogST", "Logging: Syslog-Typ",    "Wenn Syslog verwendet wird, welcher Typ soll benutzt werden?");       globvar("LogWH", "Errors", "Logging: Log what to syslog", TYPE_STRING_LIST, -  "When syslog is used, how much should be sent to it?<br><hr>" -  "Fatal: Only messages about fatal errors<br>"+ -  "Errors: Only error or fatal messages<br>"+ -  "Warning: Warning messages as well<br>"+ -  "Debug: Debug messager as well<br>"+ -  "All: Everything<br>", +  "When syslog is used, how much should be sent to it?<br /><hr />" +  "Fatal: Only messages about fatal errors<br />"+ +  "Errors: Only error or fatal messages<br />"+ +  "Warning: Warning messages as well<br />"+ +  "Debug: Debug messager as well<br />"+ +  "All: Everything<br />",    ({ "Fatal", "Errors", "Warnings", "Debug", "All" }),    syslog_disabled);    deflocaledoc("svenska", "LogWH", "Loggning: Logga vad till systemloggen", -  "När systemlogen används, vad ska skickas till den?<br><hr>" -  "Fatala: Bara felmeddelenaden som är uppmärkta som fatala<br>"+ -  "Fel: Bara felmeddelanden och fatala fel<br>"+ -  "Varningar: Samma som ovan, men även alla varningsmeddelanden<br>"+ -  "Debug: Samma som ovan, men även alla felmeddelanden<br>"+ -  "Allt: Allt<br>", +  "När systemlogen används, vad ska skickas till den?<br /><hr />" +  "Fatala: Bara felmeddelenaden som är uppmärkta som fatala<br />"+ +  "Fel: Bara felmeddelanden och fatala fel<br />"+ +  "Varningar: Samma som ovan, men även alla varningsmeddelanden<br />"+ +  "Debug: Samma som ovan, men även alla felmeddelanden<br />"+ +  "Allt: Allt<br />",    ([ "Fatal":"Fatala",    "Errors":"Fel",    "Warnings":"Varningar",    "Debug":"Debug",    "All":"Allt" ]));    deflocaledoc("deutsch", "LogWH", "Logging: zu protokollierende Daten",    "Wenn Syslog verwendet wird, welche Informationen sollen " -  "festgehalten werden?<br><hr>" -  "Fatal: Nur Mitteilungen über fatale Fehler<br>"+ -  "Errors: Nur Fehler und fatale Mitteilungen<br>"+ -  "Warning: wie oben, jedoch auch Warnungen<br>"+ -  "Debug: wie oben, jedoch auch Hinweise<br>"+ -  "All: Alles<br>", +  "festgehalten werden?<br /><hr />" +  "Fatal: Nur Mitteilungen über fatale Fehler<br />"+ +  "Errors: Nur Fehler und fatale Mitteilungen<br />"+ +  "Warning: wie oben, jedoch auch Warnungen<br />"+ +  "Debug: wie oben, jedoch auch Hinweise<br />"+ +  "All: Alles<br />",    ([ "Fatal":"Fatal",    "Errors":"Errors",    "Warnings":"Warnings",    "Debug":"Debug",    "All":"All" ]));       globvar("LogNA", "Roxen", "Logging: Log as", TYPE_STRING,    "When syslog is used, this will be the identification of the "    "Roxen daemon. The entered value will be appended to all logs.",    0, syslog_disabled);
Roxen.git/server/base_server/global_variables.pike:1040:       for(p = 1; p < argc; p++)    {    string c, v;    if(sscanf(argv[p],"%s=%s", c, v) == 2)    {    sscanf(c, "%*[-]%s", c);    if(variables[c])    {    if(catch{ -  mixed res = compile_string( "mixed f(){ return "+v+";}")()->f(); +  mixed res = ([function(void:mixed)]compile_string( "mixed f(){ return "+v+";}")()->f)();    if(sprintf("%t", res) != sprintf("%t", variables[c][VAR_VALUE]) &&    res != 0 && variables[c][VAR_VALUE] != 0)    report_debug("Warning: Setting variable "+c+"\n"    "to a value of a different type than the default value.\n"    "Default was "+sprintf("%t", variables[c][VAR_VALUE])+    " new is "+sprintf("%t", res)+"\n");    variables[c][VAR_VALUE]=res;    })    {    report_debug("Warning: Asuming '"+v+"' should be taken "
Roxen.git/server/base_server/global_variables.pike:1064:    variables[c][VAR_VALUE]=v;    }    }    else    report_debug("Unknown variable: "+c+"\n");    }    }   }       - static mapping __vars = ([ ]); + static mapping(string:mixed) __vars = ([ ]);      // These two should be documented somewhere. They are to be used to   // set global, but non-persistent, variables in Roxen.   mixed set_var(string var, mixed to)   {    return __vars[var] = to;   }      mixed query_var(string var)   {    return __vars[var];   }