Roxen.git / server / modules / scripting / perl.pike

version» Context lines:

Roxen.git/server/modules/scripting/perl.pike:6:      //<locate-token project="perl_module">LOCALE</locale-token>   // USE_DEFERRED_LOCALE;   #define LOCALE(X,Y) _DEF_LOCALE("perl_module",X,Y)      #include <module.h>   inherit "module";   inherit "roxenlib";      string cvs_version = -  "$Id: perl.pike,v 2.18 2001/07/20 12:13:15 jhs Exp $"; +  "$Id: perl.pike,v 2.19 2001/08/08 12:41:50 leif Exp $";      constant module_type = MODULE_FILE_EXTENSION | MODULE_TAG;      constant module_name = "Scripting: Perl support";   constant module_doc =    "This module provides a faster way of running Perl scripts with Roxen. "    "The module also optionally provides a &lt;perl&gt;..&lt;/perl&gt; "    "container (and a corresponding processing instruction &lt;?perl ... "    "?&gt;) to run Perl code from inside RXML pages.";      static string recent_error = 0;   static int parsed_tags = 0, script_calls = 0, script_errors = 0;      static mapping handler_settings = ([ ]);    -  + static int cache_output; +    static string script_output_mode;      constant thread_safe = 1;      #ifdef THREADS   static object mutex = Thread.Mutex();   #endif      void create()   {
Roxen.git/server/modules/scripting/perl.pike:85: Inside #if constant(system.NetWkstaUserEnum)
   LOCALE(0, "Path to the helper program used to start a Perl subprocess. "    "The default for this setting is `perl/bin/ntperl.pl'."));   #else    // Assume Unix.    defvar("helper", "perl/bin/perlrun",    LOCALE(0, "Perl Helper"), TYPE_FILE,    LOCALE(0, "Path to the helper program used to start a Perl subprocess. "    "The default for this setting is `perl/bin/perlrun'."));   #endif    -  defvar("parallel", 2, +  defvar("parallel", 3,    LOCALE(0, "Parallel scripts"), TYPE_MULTIPLE_INT,    LOCALE(0, "Number of scripts/tags that may be evaluated in parallel. "    "Don't set this higher than necessary, since it may cause the server " -  "to block. The default for this setting is 2."), -  ({ 1, 2, 3, 4, 5 }) ); +  "to block (by using all available threads). The default for this " +  "setting is 3."), +  ({ 1, 2, 3, 4, 5, 6 }) );    -  +  defvar("caching", 0, +  LOCALE(0, "Cache output"), TYPE_FLAG, +  LOCALE(0, "Whether to cache the result of scripts. This is usually " +  "not desirable, so the default for this setting is No.")); +    #if constant(getpwnam)    defvar("identity", "nobody:*",    LOCALE(0, "Run Perl as..."), TYPE_STRING,    LOCALE(0, "User and group to run Perl scripts and tags as. The default "    "for this option is `nobody:*'. Note that Roxen can't change user ID "    "unless it has sufficient permissions to do so. `*' means `use "    "same as Roxen'."));   #endif   }   
Roxen.git/server/modules/scripting/perl.pike:152: Inside #if constant(getpwnam)
      if (!ua) ua = getpwuid((int) u);    if (!ga) ga = getgrgid((int) g);       if (ua) s->set_uid = ua[2];    if (ga) s->set_gid = ga[2];    }   #endif       handler_settings = s; +  +  cache_output = query("caching");   }      static void periodic()   {    fix_settings();    ExtScript.periodic_cleanup();    call_out(periodic, 900);   }      void start()
Roxen.git/server/modules/scripting/perl.pike:202:    foreach(result[2] / "\r\n" - "", string s)    id->connection()->write(s + "\r\n");    id->connection()->write("\r\n");    }    id->connection()->write(result[1]);    }    id->connection()->close();   }      mixed handle_file_extension(Stdio.File file, string ext, object id) - { object h = gethandler(); + { +  object h = gethandler();       if (id->realfile && stringp(id->realfile))    { array result;    -  +  if (!cache_output) +  {    NOCACHE(); -  +  }       if (!h)    return Roxen.http_string_answer("<h1>Script support failed.</h1>");       mixed bt;       if (script_output_mode == "HTTP")    bt = catch (result = h->run(id->realfile, id, do_response_callback));    else    bt = catch (result = h->run(id->realfile, id));
Roxen.git/server/modules/scripting/perl.pike:271:       default:    return Roxen.http_string_answer("SCRIPT ERROR: "    "bad output mode configured.\n");    }    }    else    return Roxen.http_string_answer(sprintf("RESULT: %O", result));    }    + #if 1 +  return http_string_answer("Script file not accessible in this filesystem " +  "(no real file)."); + #else +  // Possible security leak allowing people to read the contents +  // of script files.    return 0; -  + #endif   }      constant simpletag_perl_flags = 0;      mixed simpletag_perl(string tag, mapping attr, string contents, object id,    RXML.Frame frame)   {    if (!query("tagenable"))    RXML.run_error("Perl tag not enabled in this server.");