Branch: Tag:

1999-08-30

1999-08-30 09:34:44 by Per Hedbor <ph@opera.com>

Moved documentation to separate file, try to dump all separate components to .o files (for speed). Same for modules

Rev: server/base_server/roxen.pike:1.316

1:   /* -  * $Id: roxen.pike,v 1.315 1999/08/27 12:42:21 grubba Exp $ +  * $Id: roxen.pike,v 1.316 1999/08/30 09:34:44 per Exp $    *    * The Roxen Challenger main program.    *
7:    */      // ABS and suicide systems contributed freely by Francesco Chemolli - constant cvs_version="$Id: roxen.pike,v 1.315 1999/08/27 12:42:21 grubba Exp $"; + constant cvs_version="$Id: roxen.pike,v 1.316 1999/08/30 09:34:44 per Exp $";      object backend_thread;   object argcache;
18:   #include <config.h>   #include <module.h>   #include <variables.h> + #include <stat.h>      // Inherits - inherit "read_config"; + inherit "global_variables";   inherit "hosts"; - inherit "module_support"; +    inherit "socket";   inherit "disk_cache";   inherit "language";
35:   constant __roxen_build__ = "38";      #ifdef __NT__ - constant real_version = "Roxen Challenger/"+__roxen_version__+"."+__roxen_build__+" NT"; + string real_version= "Roxen Challenger/"+__roxen_version__+"."+__roxen_build__+" NT";   #else - constant real_version = "Roxen Challenger/"+__roxen_version__+"."+__roxen_build__; + string real_version= "Roxen Challenger/"+__roxen_version__+"."+__roxen_build__;   #endif      
354:   #endif      #ifdef MODULE_DEBUG - #define MD_PERROR(X) perror X; + #define MD_PERROR(X) werror X;   #else   #define MD_PERROR(X)   #endif /* MODULE_DEBUG */
1265:    return(values(configuration_ports));   }    - string docurl; -  +    // I will remove this in a future version of roxen.   private program __p;   mapping my_loaded = ([]);
1280:    return my_loaded[(program)o]||last_module_name;   }    + class Codec + { +  program p; +  string nameof(mixed x) +  { +  if(p!=x) +  if(mixed tmp=search(all_constants(),x)) +  return "efun:"+tmp; +  +  switch(sprintf("%t",x)) +  { +  case "program": +  if(p!=x) +  { +  mixed tmp; +  if(tmp=search(master()->programs,x)) +  return tmp; +  +  if((tmp=search(values(_static_modules), x))!=-1) +  return "_static_modules."+(indices(_static_modules)[tmp]); +  } +  break; +  +  case "object": +  if(mixed tmp=search(master()->objects,x)) +  { +  if(tmp=search(master()->programs,tmp)) +  { +  return tmp; +  } +  } +  break; +  } + // werror("Did not find %O (%O)\n", x, indices(x) ); +  return ([])[0]; +  } +  +  function functionof(string x) +  { +  if(sscanf(x,"efun:%s",x)) +  return all_constants()[x]; +  +  werror("Failed to decode %s\n",x); +  return 0; +  } +  +  +  object objectof(string x) +  { +  if(sscanf(x,"efun:%s",x)) +  return all_constants()[x]; +  +  if(object tmp=(object)x) return tmp; +  werror("Failed to decode %s\n",x); +  return 0; +  +  } +  +  program programof(string x) +  { +  if(sscanf(x,"efun:%s",x)) +  return all_constants()[x]; +  +  if(sscanf(x,"_static_modules.%s",x)) +  { +  return (program)_static_modules[x]; +  } +  +  if(program tmp=(program)x) return tmp; +  werror("Failed to decode %s\n",x); +  return 0; +  } +  +  mixed encode_object(object x) +  { +  error("Cannot encode objects yet.\n"); +  } +  +  mixed decode_object(object x) +  { +  error("Cannot encode objects yet.\n"); +  } +  +  void create( program q ) +  { +  p = q; +  } + } +    program my_compile_file(string file)   { -  return compile_file( file ); + // if( file_stat( file + ".o" ) ) + // { + // if( catch { + // return decode_value( Stdio.read_bytes( file + ".o" ) ); + // }) + // rm( file + ".o" ); + // } +  m_delete( master()->programs, file); +  program p = (program)( file ); +  if( !file_stat( file+".o" ) ) +  if( catch +  { +  string data = encode_value( p, Codec(p) ); +  if( strlen( data ) ) +  Stdio.File( file+".o", "wct" )->write( data ); +  } ) +  { + #ifdef MODULE_DEBUG +  werror(" [nodump] "); + #endif +  Stdio.File( file+".o", "wct" );    } -  +  return p; + }      array compile_module( string file )   {
1339:    array st;    sscanf(s, "/cvs:%s", cvs);    - // perror("Module is "+s+"?"); + // perror("Module is "+s+"?");    if(st=file_stat(s+".pike"))    { - // perror("Yes, compile "+s+"?"); + // perror("Yes, compile "+s+"?");    if((cvs?(__p=master()->cvs_load_file( cvs+".pike" ))    :(__p=my_compile_file(s+".pike"))))    {
1353:    } else    perror(s+".pike exists, but compilation failed.\n");    } - #if 0 -  if(st=file_stat(s+".module")) -  if(__p=load_module(s+".so")) + // #if 0 +  if(st=file_stat(s+".so")) +  if(__p=predef::load_module(s+".so"))    {    my_loaded[__p]=s+".so";    module_stat_cache[s-dirname(s)]=st;    return __p(conf);    } else    perror(s+".so exists, but compilation failed.\n"); - #endif + // #endif    return 0; // FAILED..   }   
1395:    }       foreach (last_dirs_expand,dir) -  if ( (o=load(dir+f, conf)) ) return o; +  if((o=load(dir+f, conf))) +  return o;       return 0;   }
1443:   {   // SET_LOCALE(default_locale);    +     catch    {    module_stat_cache = decode_value(Stdio.read_bytes(".module_stat_cache"));
1458:    add_constant("roxen", this_object());    add_constant("RequestID", RequestID);    add_constant("load", load); +  add_constant("_Roxen_dot_set_locale", set_locale ); +  add_constant("_Roxen_dot_locale", locale ); +  add_constant("_Locale._Roxen", Locale.Roxen );       // compatibility    add_constant("hsv_to_rgb", Colors.hsv_to_rgb );
1465:    add_constant("parse_color", Colors.parse_color );    add_constant("color_name", Colors.color_name );    add_constant("colors", Colors ); -  +     fonts = (object)"fonts.pike"; -  +     Configuration = (program)"configuration"; -  add_constant("Configuration", Configuration); +  if(!file_stat( "base_server/configuration.pike.o" ) || +  file_stat("base_server/configuration.pike.o")[ST_MTIME] < +  file_stat("base_server/configuration.pike")[ST_MTIME]) +  { +  Stdio.write_file( "base_server/configuration.pike.o", +  encode_value( Configuration, Codec( Configuration) ) ); +  } +  add_constant("Configuration", Configuration ); +  add_constant("Fonts", fonts ); +  add_constant("_____argcache", argcache ); +  add_constant("ArgCache", ArgCache ); +  add_constant("Stdio_dot_File_indeed", Stdio.File ); // for encode stuff +     call_out(post_create,1); //we just want to delay some things a little   }   
1848:    return (prot+"://"+host+":"+p+"/");   }    -  - // 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. -  - int cache_disabled_p() { return !QUERY(cache); } - int syslog_disabled() { return QUERY(LogA)!="syslog"; } - private int ident_disabled_p() { return QUERY(default_ident); } -  +    class ImageCache   {    string name;
2618:   }       - private void define_global_variables( int argc, array (string) argv ) - { -  int p; -  -  globvar("set_cookie", 0, "Set unique user id cookies", TYPE_FLAG, -  #"If set to Yes, all users of your server whose clients support - cookies will get a unique 'user-id-cookie', this can then be - used in the log and in scripts to track individual users."); -  -  deflocaledoc( "svenska", "set_cookie", -  "Sätt en unik cookie för alla användare", -  #"Om du sätter den här variabeln till 'ja', så kommer - alla användare att få en unik kaka (cookie) med namnet 'RoxenUserID' satt. Den - här kakan kan användas i skript för att spåra individuella användare. Det är - inte rekommenderat att använda den här variabeln, många användare tycker illa - om cookies"); -  -  globvar("set_cookie_only_once",1,"Set ID cookies only once",TYPE_FLAG, -  #"If set to Yes, Roxen will attempt to set unique user ID cookies -  only upon receiving the first request (and again after some minutes). Thus, if - the user doesn't allow the cookie to be set, she won't be bothered with - multiple requests.",0, -  lambda() {return !QUERY(set_cookie);}); -  -  deflocaledoc( "svenska", "set_cookie_only_once", -  "Sätt bara kakan en gång per användare", -  #"Om den här variablen är satt till 'ja' så kommer roxen bara - försöka sätta den unika användarkakan en gång. Det gör att om användaren inte - tillåter att kakan sätts, så slipper hon eller han iallafall nya frågor under - några minuter"); -  -  globvar("RestoreConnLogFull", 0, -  "Log entire file length in restored connections", -  TYPE_TOGGLE, -  "If this toggle is enabled log entries for restored connections " -  "will log the amount of sent data plus the restoration location. " -  "Ie if a user has downloaded 100 bytes of a file already, and makes " -  "a Range request fetching the remaining 900 bytes, the log entry " -  "will log it as if the entire 1000 bytes were downloaded. " -  "<p>This is useful if you want to know if downloads were successful " -  "(the user has the complete file downloaded). The drawback is that " -  "bandwidth statistics on the log file will be incorrect. The " -  "statistics in Roxen will continue being correct."); -  -  deflocaledoc("svenska", "RestoreConnLogFull", -  "Logga hela fillängden vid återstartad nerladdning", -  "När den här flaggar är satt så loggar Roxen hela längden på " -  "en fil vars nerladdning återstartas. Om en användare först " -  "laddar hem 100 bytes av en fil och sedan laddar hem de " -  "återstående 900 bytes av filen med en Range-request så " -  "kommer Roxen logga det som alla 1000 bytes hade laddats hem. " -  "<p>Detta kan vara användbart om du vill se om en användare " -  "har lyckats ladda hem hela filen. I normalfallet vill du att " -  "ha denna flagga avslagen."); -  -  globvar("show_internals", 1, "Show the internals", 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."); -  -  globvar("default_font_size", 32, 0, TYPE_INT, 0, 0, 1); -  globvar("default_font", "lucida", "Fonts: Default font", TYPE_FONT, -  "The default font to use when modules request a font."); -  -  deflocaledoc( "svenska", "default_font", "Typsnitt: Normaltypsnitt", -  #"När moduler ber om en typsnitt som inte finns, eller skriver - grafisk text utan att ange ett typsnitt, så används det här typsnittet."); -  -  globvar("font_dirs", ({"../local/nfonts/", "nfonts/" }), -  "Fonts: Font directories", TYPE_DIR_LIST, -  "This is where the fonts are located."); -  -  deflocaledoc( "svenska", "font_dirs", "Typsnitt: Typsnittssökväg", -  "Sökväg för typsnitt."); -  -  -  globvar("logdirprefix", "../logs/", "Log directory prefix", -  TYPE_DIR|VAR_MORE, -  #"This is the default file path that will be prepended to the log -  file path in all the default modules and the virtual server."); -  -  deflocaledoc( "svenska", "logdirprefix", "Loggningsmappprefix", -  "Alla nya loggar som skapas får det här prefixet."); -  -  // Cache variables. The actual code recides in the file -  // 'disk_cache.pike' -  -  -  globvar("cache", 0, "Proxy disk cache: Enabled", TYPE_FLAG, -  "If set to Yes, caching will be enabled."); -  deflocaledoc( "svenska", "cache", "Proxydiskcache: På", -  "Om ja, använd cache i alla proxymoduler som hanterar det."); -  -  globvar("garb_min_garb", 1, "Proxy disk cache: Clean size", TYPE_INT, -  "Minimum number of Megabytes removed when a garbage collect is done.", -  0, cache_disabled_p); -  deflocaledoc( "svenska", "garb_min_garb", -  "Proxydiskcache: Minimal rensningsmängd", -  "Det minsta antalet Mb som tas bort vid en cacherensning."); -  -  -  globvar("cache_minimum_left", 5, "Proxy disk cache: Minimum " -  "available free space and inodes (in %)", TYPE_INT, - #"If less than this amount of disk space or inodes (in %) is left, -  the cache will remove a few files. This check may work -  half-hearted if the diskcache is spread over several filesystems.", -  0, - #if constant(filesystem_stat) -  cache_disabled_p - #else -  1 - #endif /* filesystem_stat */ -  ); -  deflocaledoc( "svenska", "cache_minimum_free", -  "Proxydiskcache: Minimal fri disk", -  "Om det är mindre plats (i %) ledigt på disken än vad som " -  "anges i den här variabeln så kommer en cacherensning ske."); -  -  -  globvar("cache_size", 25, "Proxy disk cache: Size", TYPE_INT, -  "How many MB may the cache grow to before a garbage collect is done?", -  0, cache_disabled_p); -  deflocaledoc( "svenska", "cache_size", "Proxydiskcache: Storlek", -  "Cachens maximala storlek, i Mb."); -  -  globvar("cache_max_num_files", 0, "Proxy disk cache: Maximum number " -  "of files", TYPE_INT, "How many cache files (inodes) may " -  "be on disk before a garbage collect is done ? May be left " -  "zero to disable this check.", -  0, cache_disabled_p); -  deflocaledoc( "svenska", "cache_max_num_files", -  "Proxydiskcache: Maximalt antal filer", -  "Om det finns fler än så här många filer i cachen " -  "kommer en cacherensning ske. Sätt den här variabeln till " -  "noll för att hoppa över det här testet."); -  -  globvar("bytes_per_second", 50, "Proxy disk cache: Bytes per second", -  TYPE_INT, -  "How file size should be treated during garbage collect. " -  " Each X bytes counts as a second, so that larger files will" -  " be removed first.", -  0, cache_disabled_p); -  deflocaledoc( "svenska", "bytes_per_second", -  "Proxydiskcache: Bytes per sekund", -  "Normalt sätt så tas de äldsta filerna bort, men filens " -  "storlek modifierar dess 'ålder' i cacherensarens ögon. " -  "Den här variabeln anger hur många bytes som ska motsvara " -  "en sekund."); -  -  globvar("cachedir", "/tmp/roxen_cache/", -  "Proxy disk cache: Base Cache Dir", -  TYPE_DIR, -  "This is the base directory where cached files will reside. " -  "To avoid mishaps, 'roxen_cache/' is always prepended to this " -  "variable.", -  0, cache_disabled_p); -  deflocaledoc("svenska", "cachedir", "Proxydiskcache: Cachedirectory", -  "Den här variabeln anger vad cachen ska sparas. " -  "För att undvika fatala misstag så adderas alltid " -  "'roxen_cache/' till den här variabeln när den sätts om."); -  -  globvar("hash_num_dirs", 500, -  "Proxy disk cache: Number of hash directories", -  TYPE_INT, -  "This is the number of directories to hash the contents of the disk " -  "cache into. Changing this value currently invalidates the whole " -  "cache, since the cache cannot find the old files. In the future, " -  " the cache will be recalculated when this value is changed.", -  0, cache_disabled_p); -  deflocaledoc("svenska", "hash_num_dirs", -  "Proxydiskcache: Antalet cachesubdirectoryn", -  "Disk cachen lagrar datan i flera directoryn, den här " -  "variabeln anger i hur många olika directoryn som datan ska " -  "lagras. Om du ändrar på den här variabeln så blir hela den " -  "gamla cachen invaliderad."); -  -  globvar("cache_keep_without_content_length", 1, "Proxy disk cache: " -  "Keep without Content-Length", TYPE_FLAG, "Keep files " -  "without Content-Length header information in the cache?", -  0, cache_disabled_p); -  deflocaledoc("svenska", "cache_keep_without_content_length", -  "Proxydiskcache: Behåll filer utan angiven fillängd", -  "Spara filer även om de inte har någon fillängd. " -  "Cachen kan innehålla trasiga filer om den här " -  "variabeln är satt, men fler filer kan sparas"); -  -  globvar("cache_check_last_modified", 0, "Proxy disk cache: " -  "Refresh on Last-Modified", TYPE_FLAG, -  "If set, refreshes files without Expire header information " -  "when they have reached double the age they had when they got " -  "cached. This may be useful for some regularly updated docs as " -  "online newspapers.", -  0, cache_disabled_p); -  deflocaledoc("svenska", "cache_check_last_modified", -  "Proxydiskcache: Kontrollera värdet at Last-Modifed headern", - #"Om den här variabeln är satt så kommer även filer utan Expire header att tas - bort ur cachen när de blir dubbelt så gamla som de var när de hämtades från - källservern om de har en last-modified header som anger när de senast - ändrades"); -  -  globvar("cache_last_resort", 0, "Proxy disk cache: " -  "Last resort (in days)", TYPE_INT, -  "How many days shall files without Expires and without " -  "Last-Modified header information be kept?", -  0, cache_disabled_p); -  deflocaledoc("svenska", "cache_last_resort", -  "Proxydiskcache: Spara filer utan datum", -  "Hur många dagar ska en fil utan både Expire och " -  "Last-Modified behållas i cachen? Om du sätter den " -  "här variabeln till noll kommer de inte att sparas alls."); -  -  globvar("cache_gc_logfile", "", -  "Proxy disk cache: " -  "Garbage collector logfile", TYPE_FILE, -  "Information about garbage collector runs, removed and refreshed " -  "files, cache and disk status goes here.", -  0, cache_disabled_p); -  -  deflocaledoc("svenska", "cache_gc_logfile", -  "Proxydiskcache: Loggfil", -  "Information om cacherensningskörningar sparas i den här filen" -  "."); -  /// End of cache variables.. -  -  globvar("docurl2", "http://www.roxen.com/documentation/context.pike?page=", -  "Documentation URL", TYPE_STRING|VAR_MORE|VAR_EXPERT, -  "The URL to prepend to all documentation urls throughout the " -  "server. This URL should _not_ end with a '/'."); -  deflocaledoc("svenska", "docurl2", "DokumentationsURL", -  "DokumentationsURLen används för att få kontextkänslig hjälp"); -  -  globvar("pidfile", "/tmp/roxen_pid_$uid", "PID file", -  TYPE_FILE|VAR_MORE, -  "In this file, the server will write out it's PID, and the PID " -  "of the start script. $pid will be replaced with the pid, and " -  "$uid with the uid of the user running the process.\n" -  "<p>Note: It will be overridden by the command line option."); -  deflocaledoc("svenska", "pidfile", "ProcessIDfil", -  "I den här filen sparas roxen processid och processidt " -  "for roxens start-skript. $uid byts ut mot användaridt för " -  "den användare som kör roxen"); -  -  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>" -  "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", "Identitet: Använd roxens normala" -  " identitetssträng", -  "Ska roxen använda sitt normala namn ("+real_version+")." -  "Om du sätter den här variabeln till 'nej' så kommer du att " -  "få välja vad roxen ska kalla sig."); -  -  globvar("ident", replace(real_version," ","·"), "Identify: Identify as", -  TYPE_STRING /* |VAR_MORE */, -  "Enter the name that Roxen should use when talking to clients. ", -  0, ident_disabled_p); -  deflocaledoc("svenska", "ident", "Identitet: Roxens identitet", -  "Det här är det namn som roxen kommer att använda sig av."); -  -  globvar("DOC", 1, "Configuration interface: Help texts", TYPE_FLAG|VAR_MORE, -  "Do you want documentation? (this is an example of documentation)"); -  deflocaledoc("svenska", "DOC", "Konfigurationsinterfacet: Hjälptexter", -  "Vill du ha hjälptexter (den här texten är en typisk " -  " hjälptext)"); -  -  globvar("NumAccept", 1, "Number of accepts to attempt", -  TYPE_INT_LIST|VAR_MORE, -  "You can here state the maximum number of accepts to attempt for " -  "each read callback from the main socket. <p> Increasing this value " -  "will make the server faster for users making many simultaneous " -  "connections to it, or if you have a very busy server. The higher " -  "you set this value, the less load balancing between virtual " -  "servers. (If there are 256 more or less simultaneous " -  "requests to server 1, and one to server 2, and this variable is " -  "set to 256, the 256 accesses to the first server might very well " -  "be handled before the one to the second server.)", -  ({ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 })); -  deflocaledoc("svenska", "NumAccept", -  "Uppkopplingsmottagningsförsök per varv i huvudloopen", -  "Antalet uppkopplingsmottagningsförsök per varv i huvudlopen. " -  "Om du ökar det här värdet så kan server svara snabbare om " -  "väldigt många använder den, men lastbalanseringen mellan dina " -  "virtuella servrar kommer att bli mycket sämre (tänk dig att " -  "det ligger 255 uppkopplingar och väntar i kön för en server" -  ", och en uppkoppling i kön till din andra server, och du " -  " har satt den här variabeln till 256. Alla de 255 " -  "uppkopplingarna mot den första servern kan då komma " -  "att hanteras <b>före</b> den ensamma uppkopplingen till " -  "den andra server."); -  -  globvar("ConfigPorts", ({ ({ 22202, "http", "ANY", "" }) }), -  "Configuration interface: Ports", -  TYPE_PORTS, - #"These are the ports through which you can configure the server.<br> -  - Note that you should at least have one open port, since otherwise you won't be - able to configure your server."); -  -  deflocaledoc("svenska", "ConfigPorts", -  "Konfigurationsinterfacet: Portar", - #"Det här är de portar som du kan använda för att konfigurera -  servern. <br> -  - Notera att du alltid bör ha <b>minst</b> en port öppen, så om du -  t.ex. ska flytta konfigurationsinterfacet från en http port till en ssl3 port, -  ta inte bort den gamla porten innan du har verifierat att den nya verkligen -  fungerar. Det är rätt svårt att konfigurera roxen utan dess -  konfigurationsinterface, även om det går."); -  -  globvar("ModuleListType", "Original", -  "Configuration interface: Add module page look ", -  TYPE_STRING_LIST, - #"This variable defines how the add module page will look like. The original - version has graphical headers and the description for each of the modules. - If you know your way around Roxen, the compact mode might be better. Then - You will get a select list which contains module names only.", -  ({ "Original", "Compact" })); -  -  deflocaledoc("svenska", "ModuleListType", -  "Konfigurationsinterfacet: Utseendet av addera-modulsidan", - #"Här kan du ställa in utseendet av sidan där du adderar nya moduler. - Standardversionen har en lång sida med alla moduler med modulbeskrivningar. - Den kompakta versionen innehåller bara en select-lista med alla moduler, - utan hjälptexterna och går därför mycket snabbare att ladda.", -  ([ "Original": "Standard", -  "Compact" : "Kompakt" ])); -  -  -  globvar("ConfigurationURL", -  "", -  "Configuration interface: URL", TYPE_STRING, -  "The URL of the configuration interface. This is used to " -  "generate redirects now and then (when you press save, when " -  "a module is added, etc.)."); -  deflocaledoc("svenska", "ConfigurationURL", -  "Konfigurationsinterfacet: URL", -  #"Konfigurationsinterfacets URL. Normalt sätt så behöver du - inte ställa in den här variabeln, eftersom den automatiskt genereras från -  portvariablen, men ibland kan det vara bra att kunna ställa in den."); -  -  globvar("ConfigurationPassword", "", "Configuration interface: Password", -  TYPE_PASSWORD|VAR_EXPERT, -  "The password you will have to enter to use the configuration " -  "interface. Please note that changing this password in the " -  "configuration interface will _not_ require an additional entry " -  "of the password, so it is easy to make a typo. It is recommended " -  "that you use the <a href=/(changepass)/Globals/>form instead</a>."); -  deflocaledoc("svenska", "ConfigurationPassword", -  "Konfigurationsinterface: Lösenord", -  #"Den här variablen bör du inte pilla på. Men det är lösenordet -  för användaren som ska få konfigurera roxen, krypterat med crypt(3)"); -  -  globvar("ConfigurationUser", "", "Configuration interface: User", -  TYPE_STRING|VAR_EXPERT, -  "The username you will have to enter to use the configuration " -  "interface"); -  deflocaledoc("svenska", "ConfigurationUser", -  "Konfigurationsinterface: Användare", -  #"Den här variablen bör du inte pilla på. Men det är användaren -  som ska få konfigurera roxen"); -  -  globvar("ConfigurationIPpattern","*", "Configuration interface: IP-Pattern", -  TYPE_STRING|VAR_MORE, -  "Only clients running on computers with IP numbers matching " -  "this pattern will be able to use the configuration " -  "interface."); -  deflocaledoc("svenska", "ConfigurationIPpattern", -  "Konfigurationsinterfacet: IPnummermönster", - #"Bara klienters vars datorers IP-nummer matchar det här mönstret -  kan ansluta till konfigurationsinterfacet. Ett normalt mönster är ditt lokala -  C-nät, t.ex. 194.52.182.*."); -  -  globvar("User", "", "Change uid and gid to", TYPE_STRING, -  "When roxen is run as root, to be able to open port 80 " -  "for listening, change to this user-id and group-id when the port " -  " has been opened. If you specify a symbolic username, the " -  "default group of that user will be used. " -  "The syntax is user[:group]."); -  deflocaledoc("svenska", "User", "Byt UID till", - #"När roxen startas som root, för att kunna öppna port 80 och köra CGI skript - samt pike skript som den användare som äger dem, så kan du om du vill - specifiera ett användarnamn här. Roxen kommer om du gör det att byta till den - användaren när så fort den har öppnat sina portar. Roxen kan dock fortfarande - byta tillbaka till root för att köra skript som rätt användare om du inte - sätter variabeln 'Byt UID och GID permanent' till ja. Användaren kan - specifieras antingen som ett symbolisk användarnamn (t.ex. 'www') eller som ett - numeriskt användarID. Om du vill kan du specifera vilken grupp som ska - användas genom att skriva användare:grupp. Normalt sätt så används användarens - normal grupper."); -  -  globvar("permanent_uid", 0, "Change uid and gid permanently", -  TYPE_FLAG, -  "If this variable is set, roxen will set it's uid and gid " -  "permanently. This disables the 'exec script as user' fetures " -  "for CGI, and also access files as user in the filesystems, but " -  "it gives better security."); -  deflocaledoc("svenska", "permanent_uid", -  "Byt UID och GID permanent", - #"Om roxen byter UID och GID permament kommer det inte gå att konfigurera nya -  portar under 1024, det kommer inte heller gå att köra CGI och pike skript som -  den användare som äger skriptet. Däremot så kommer säkerheten att vara högre, -  eftersom ingen kan få roxen att göra något som administratöranvändaren -  root"); -  -  globvar("ModuleDirs", ({ "../local/modules/", "modules/" }), -  "Module directories", TYPE_DIR_LIST, -  "This is a list of directories where Roxen should look for " -  "modules. Can be relative paths, from the " -  "directory you started roxen, " + getcwd() + " this time." -  " The directories are searched in order for modules."); -  deflocaledoc("svenska", "ModuleDirs", "Modulsökväg", - #"En lista av directoryn som kommer att sökas igenom när en -  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."); -  -  globvar("Supports", "#include <etc/supports>\n", -  "Client supports regexps", TYPE_TEXT_FIELD|VAR_MORE, -  "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>" -  //"<a href=$docurl/configuration/regexp.html>regular-expression</a>" -  "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", -  "Bläddrarfunktionalitetsdatabas", - #"En databas över vilka funktioner de olika bläddrarna som används klarar av. -  Normalt sätt så hämtas den här databasen från filen server/etc/supports, men -  du kan om du vill specifiera fler mönster i den här variabeln. Formatet ser -  ur så här:<pre> -  reguljärt uttryck som matchar bäddrarens namn funktion, funktion, ... -  </pre>Se filen server/etc/supports för en mer utförlig dokumentation"); -  -  globvar("audit", 0, "Audit trail", TYPE_FLAG, -  "If Audit trail is set to Yes, all changes of uid will be " -  "logged in the Event log."); -  deflocaledoc("svenska", "audit", "Logga alla användaridväxlingar", - #"Om du slår på den är funktionen så kommer roxen logga i debugloggen (eller - systemloggen om den funktionen används) så fort användaridt byts av någon - anlending."); -  - #if efun(syslog) -  globvar("LogA", "file", "Logging method", TYPE_STRING_LIST|VAR_MORE, -  "What method to use for logging, default is file, but " -  "syslog is also available. When using file, the output is really" -  " sent to stdout and stderr, but this is handled by the " -  "start script.", -  ({ "file", "syslog" })); -  deflocaledoc("svenska", "LogA", "Loggningsmetod", - #"Hur ska roxens debug, fel, informations och varningsmeddelanden loggas? -  Normalt sätt så loggas de tilldebugloggen (logs/debug/defaul.1 etc), men de -  kan även skickas till systemloggen kan om du vill.", -  ([ "file":"loggfil", -  "syslog":"systemloggen"])); -  -  globvar("LogSP", 1, "Syslog: Log PID", TYPE_FLAG, -  "If set, the PID will be included in the syslog.", 0, -  syslog_disabled); -  deflocaledoc("svenska", "LogSP", "Systemlogg: Logga roxens processid", -  "Ska roxens processid loggas i systemloggen?"); -  globvar("LogCO", 0, "Syslog: Log to system console", TYPE_FLAG, -  "If set and syslog is used, the error/debug message will be printed" -  " to the system console as well as to the system log.", -  0, syslog_disabled); -  deflocaledoc("svenska", "LogCO", "Systemlogg: Logga till konsolen", -  "Ska roxen logga till konsolen? Om den här variabeln är satt " -  "kommer alla meddelanden som går till systemloggen att även " -  "skickas till datorns konsol."); -  globvar("LogST", "Daemon", "Syslog: Log type", TYPE_STRING_LIST, -  "When using SYSLOG, which log type should be used.", -  ({ "Daemon", "Local 0", "Local 1", "Local 2", "Local 3", -  "Local 4", "Local 5", "Local 6", "Local 7", "User" }), -  syslog_disabled); -  deflocaledoc( "svenska", "LogST", "Systemlogg: Loggningstyp", -  "När systemloggen används, vilken loggningstyp ska " -  "roxen använda?"); -  -  globvar("LogWH", "Errors", "Syslog: Log what", 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>", -  ({ "Fatal", "Errors", "Warnings", "Debug", "All" }), -  syslog_disabled); -  deflocaledoc("svenska", "LogWH", "Systemlogg: Logga vad", -  "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" ])); -  -  globvar("LogNA", "Roxen", "Syslog: 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); -  deflocaledoc("svenska", "LogNA", -  "Systemlogg: Logga som", - #"När systemloggen används så kommer värdet av den här variabeln användas -  för att identifiera den här roxenservern i loggarna."); - #endif -  - #ifdef THREADS -  globvar("numthreads", 5, "Number of threads to run", TYPE_INT, -  "The number of simultaneous threads roxen will use.\n" -  "<p>Please note that even if this is one, Roxen will still " -  "be able to serve multiple requests, using a select loop based " -  "system.\n" -  "<i>This is quite useful if you have more than one CPU in " -  "your machine, or if you have a lot of slow NFS accesses.</i>"); -  deflocaledoc("svenska", "numthreads", -  "Antal trådar", - #"Roxen har en så kallad trådpool. Varje förfrågan som kommer in till roxen -  hanteras av en tråd, om alla trådar är upptagna så ställs frågan i en kö. -  Det är bara själva hittandet av rätt fil att skicka som använder de här -  trådarna, skickandet av svaret till klienten sker i bakgrunden, så du behöver -  bara ta hänsyn till evenetuella processorintensiva saker (som &lt;gtext&gt;) -  när då ställer in den här variabeln. Skönskvärdet 5 räcker för de allra -  flesta servrar"); - #endif -  -  globvar("AutoUpdate", 1, "Update the supports database automatically", -  TYPE_FLAG, -  "If set to Yes, the etc/supports file will be updated automatically " -  "from www.roxen.com now and then. This is recomended, since " -  "you will then automatically get supports information for new " -  "clients, and new versions of old ones."); -  deflocaledoc("svenska", "AutoUpdate", -  "Uppdatera 'supports' databasen automatiskt", - #"Ska supportsdatabasen uppdateras automatiskt från www.roxen.com en gång per -  vecka? Om den här optionen är påslagen så kommer roxen att försöka ladda ner -  en ny version av filen etc/supports från http://www.roxen.com/supports en -  gång per vecka. Det är rekommenderat att du låter den vara på, eftersom det -  kommer nya versioner av bläddrare hela tiden, som kan hantera nya saker."); -  -  globvar("next_supports_update", time()+3600, "", TYPE_INT,"",0,1); -  -  globvar("abs_engage", 0, "Anti-Block-System: Enable", TYPE_FLAG|VAR_MORE, - #"If set, the anti-block-system will be enabled. -  This will restart the server after a configurable number of minutes if it -  locks up. If you are running in a single threaded environment heavy -  calculations will also halt the server. In multi-threaded mode bugs such as -  eternal loops will not cause the server to reboot, since only one thread is -  blocked. In general there is no harm in having this option enabled. "); -  -  deflocaledoc("svenska", "abs_engage", -  "AntiBlockSystem: Slå på AntiBlockSystemet", - #"Ska antilåssystemet vara igång? Om det är det så kommer roxen automatiskt -  att starta om om den har hängt sig mer än några minuter. Oftast så beror -  hängningar på buggar i antingen operativsystemet eller i en modul. Den -  senare typen av hängningar påverkar inte en trådad roxen, medans den första -  typen gör det."); -  -  globvar("abs_timeout", 5, "Anti-Block-System: Timeout", -  TYPE_INT_LIST|VAR_MORE, - #"If the server is unable to accept connection for this many -  minutes, it will be restarted. You need to find a balance: -  if set too low, the server will be restarted even if it's doing -  legal things (like generating many images), if set too high you might -  get a long downtime if the server for some reason locks up.", -  ({1,2,3,4,5,10,15}), -  lambda() {return !QUERY(abs_engage);}); -  -  deflocaledoc("svenska", "abs_timeout", -  "AntiBlockSystem: Tidsbegränsning", - #"Om servern inte svarar på några frågor under så här många -  minuter så kommer roxen startas om automatiskt. Om du -  har en väldigt långsam dator kan en minut vara för -  kort tid för en del saker, t.ex. diagramritning kan ta -  ett bra tag."); -  -  -  globvar("locale", "standard", "Language", TYPE_STRING_LIST, -  "Locale, used to localise all messages in roxen.\n" - #"Standard means using the default locale, which varies according to the - value of the 'LANG' environment variable.", sort(indices(Locale.Roxen) - -  ({ "Modules" }))); -  deflocaledoc("svenska", "locale", "Språk", -  "Den här variablen anger vilket språk roxen ska använda. " -  "'standard' betyder att språket sätts automatiskt från " -  "värdet av omgivningsvariabeln LANG."); -  -  globvar("suicide_engage", -  0, -  "Automatic Restart: Enable", -  TYPE_FLAG|VAR_MORE, - #"If set, Roxen will automatically restart after a configurable number of - days. Since Roxen uses a monolith, non-forking server model the process tends - to grow in size over time. This is mainly due to heap fragmentation but also - because of memory leaks." -  ); -  deflocaledoc("svenska", "suicide_engage", -  "Automatisk omstart: Starta om automatiskt", - #"Roxen har stöd för att starta automatiskt då ock då. Eftersom roxen är en - monolitisk icke-forkande server (en enda långlivad process) så tenderar - processen att växa med tiden. Det beror mest på minnesfragmentation, men även - på att en del minnesläckor fortfarande finns kvar. Ett sätt att återvinna minne - är att starta om servern lite då och då, vilket roxen kommer att göra om du - slår på den här funktionen. Notera att det tar ett litet tag att starta om -  servern."); -  - globvar("suicide_timeout", -  7, -  "Automatic Restart: Timeout", -  TYPE_INT_LIST|VAR_MORE, -  "Automatically restart the server after this many days.", -  ({1,2,3,4,5,6,7,14,30}), -  lambda(){return !QUERY(suicide_engage);}); -  deflocaledoc("svenska", "suicide_timeout", -  "Automatisk omstart: Tidsbegränsning (i dagar)", - #"Om roxen är inställd till att starta om automatiskt, starta om - så här ofta. Tiden är angiven i dagar"); -  -  -  globvar("argument_cache_in_db", 0, -  "Argument Cache: Store the argument cache in a mysql database", -  TYPE_FLAG|VAR_MORE, -  "If set, store the argument cache in a mysql " -  "database. This is very useful for load balancing using multiple " -  "roxen servers, since the mysql database will handle " -  " synchronization"); -  -  globvar( "argument_cache_db_path", "mysql://localhost/roxen", -  "Argument Cache: Database URL to use", -  TYPE_STRING|VAR_MORE, -  "The database to use to store the argument cache", -  0, -  lambda(){ return !QUERY(argument_cache_in_db); }); -  -  globvar( "argument_cache_dir", "../argument_cache/", -  "Argument Cache: Cache directory", -  TYPE_DIR|VAR_MORE, -  "The cache directory to use to store the argument cache." -  " Please note that load balancing is not available for most modules " -  " (such as gtext, diagram etc) unless you use a mysql database to " -  "store the argument caches", -  0, -  lambda(){ return QUERY(argument_cache_in_db); }); -  -  -  -  -  setvars(retrieve("Variables", 0)); -  -  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(); -  if(sprintf("%t", res) != sprintf("%t", variables[c][VAR_VALUE]) && -  res != 0 && variables[c][VAR_VALUE] != 0) -  werror("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; -  }) -  { -  werror("Warning: Asuming '"+v+"' should be taken " -  "as a string value.\n"); -  if(!stringp(variables[c][VAR_VALUE])) -  werror("Warning: Old value was not a string.\n"); -  variables[c][VAR_VALUE]=v; -  } -  } -  else -  perror("Unknown variable: "+c+"\n"); -  } -  } -  docurl=QUERY(docurl2); -  - } -  -  +    // Somewhat misnamed, since there can be more then one   // configuration-interface port nowdays. But, anyway, this function   // opens and listens to all configuration interface ports.
3703:    }   }    +  + void dump( string file ) + { +  program p = master()->programs[ replace(getcwd() +"/"+ file , "//", "/" ) ]; +  array q; +  +  if(!p) +  return; +  +  if(!file_stat( file+".o" ) || +  (file_stat(file+".o")[ST_MTIME] < file_stat(file)[ST_MTIME])) +  if(q=catch{ +  Stdio.write_file(file+".o",encode_value(p,Codec(p))); +  }) +  werror("Cannot encode "+file+": "+describe_backtrace(q)+"\n"); + } +    // And then we have the main function, this is the oldest function in   // Roxen :) It has not changed all that much since Spider 2.0.   int main(int|void argc, array (string)|void argv)   { -  if(getenv("LANG")=="sv") -  default_locale = ( Locale.Roxen.svenska ); - // else - // SET_LOCALE( Locale.Roxen.standard ); +  // Dump some programs (for speed) +  dump( "base_server/newdecode.pike" ); +  dump( "base_server/read_config.pike" ); +  dump( "base_server/global_variables.pike" ); +  dump( "base_server/module_support.pike" ); +  dump( "base_server/http.pike" ); +  dump( "base_server/smartpipe.pike" ); +  dump( "base_server/socket.pike" ); +  dump( "base_server/cache.pike" ); +  dump( "base_server/dates.pike"); +  + // dump( "base_server/disk_cache.pike"); + // cannot encode this one yet... +  +  dump( "base_server/fonts.pike"); +  dump( "base_server/highlight_pike.pike"); +  dump( "base_server/hosts.pike"); +  dump( "base_server/language.pike"); +  dump( "base_server/persistent.pike"); +  dump( "base_server/restorable.pike"); + // dump( "base_server/rxml.pike" ); // #includeed in configuration.pike +  +  call_out( lambda() { +  dump( "base_server/state.pike" ); +  dump( "base_server/wizard.pike" ); +  dump( "base_server/proxyauth.pike" ); +  dump( "base_server/html.pike" ); +  dump( "base_server/module.pike" ); +  }, 9); +  +  +  switch(getenv("LANG")) +  { +  case "sv": +  default_locale = Locale.Roxen["svenska"]; +  break; +  case "jp": +  default_locale = Locale.Roxen["nihongo"]; +  break; +  }    SET_LOCALE(default_locale);    initiate_languages();    mixed tmp; -  +     start_time = boot_time = time();    -  add_constant("write", perror); -  -  +     mark_fd(0, "Stdin");    mark_fd(1, "Stdout");    mark_fd(2, "Stderr");
3731:    if(configuration_dir[-1] != '/')    configuration_dir += "/";    -  +     startpid = getppid();    roxenpid = getpid();   
3794:   // loaded before the configurations was enabled (a configuration is a   // virtual server, perhaps the name should be changed internally as   // well.. :-) -  if(root) -  { -  destruct(configuration_interface()); -  configuration_interface()->build_root(root); -  } + // if(root) + // { + // destruct(configuration_interface()); + // configuration_interface()->build_root(root); + // }       call_out(update_supports_from_roxen_com,    QUERY(next_supports_update)-time());
3837:      string diagnose_error(array from)   { -  +    }      // Called from the configuration interface.
3852:    if(!sscanf(value, "%*s/roxen_cache"))    {    // FIXME: LOCALE? -  object node; -  node = (configuration_interface()->root->descend("Globals", 1)-> -  descend("Proxy disk cache: Base Cache Dir", 1)); -  if(node && !node->changed) node->change(1); +  // We will skip this soon anyway.... + // object node; + // node = (configuration_interface()->root->descend("Globals", 1)-> + // descend("Proxy disk cache: Base Cache Dir", 1)); + // if(node && !node->changed) node->change(1);    mkdirhier(value+"roxen_cache/foo");    call_out(set, 0, "cachedir", value+"roxen_cache/");    }
3889:    SET_LOCALE(default_locale);    if(root)    { +  root->clear();   // destruct(root);   // configuration_interface()->root = configuration_interface()->Node();    configuration_interface()->
3907:   mapping host_accuracy_cache = ([]);   int is_ip(string s)   { -  return(replace(s, -  ({ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "." }), -  ({ "","","","","","","","","","","" })) == ""); +  return (replace(s,"0123456789."/"",({""})*11) == "");   }      object find_server_for(object id, string host, string|void port)