Roxen.git / server / base_server / roxen.pike

version» Context lines:

Roxen.git/server/base_server/roxen.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2004, Roxen IS.   //   // The Roxen WebServer main program.   //   // Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.   // ABS and suicide systems contributed freely by Francesco Chemolli    - constant cvs_version="$Id: roxen.pike,v 1.931 2006/09/05 12:30:33 stewa Exp $"; + constant cvs_version="$Id: roxen.pike,v 1.932 2006/09/07 07:27:00 noring Exp $";      //! @appears roxen   //!   //! The Roxen WebServer main program.      // The argument cache. Used by the image cache.   ArgCache argcache;      // Some headerfiles   #define IN_ROXEN
Roxen.git/server/base_server/roxen.pike:5470:      static string _sprintf( )   {    return "roxen";   }      // Support for logging in configurations and modules.      class LogFormat   { +  static int rusage_time; +  static array(int) rusage_data; +  static void update_rusage() +  { +  if(!rusage_data || time(1) != rusage_time) +  { +  rusage_data = rusage(); +  rusage_time = time(1); +  } +  } +  +  static int server_cputime() +  { +  update_rusage(); +  if(rusage_data && sizeof(rusage_data) >= 2) +  return rusage_data[0] + rusage_data[1]; +  return 0; +  } +  +  static int server_usertime() +  { +  update_rusage(); +  if(rusage_data && sizeof(rusage_data) >= 1) +  return rusage_data[0]; +  return 0; +  } +  +  static int server_systime() +  { +  update_rusage(); +  if(rusage_data && sizeof(rusage_data) >= 2) +  return rusage_data[1]; +  return 0; +  } +     static string host_ip_to_int(string s)    {    int a, b, c, d;    sscanf(s, "%d.%d.%d.%d", a, b, c, d);    return sprintf("%c%c%c%c",a, b, c, d);    }       static string extract_user(string from)    {    array tmp;
Roxen.git/server/base_server/roxen.pike:5540:    " request_id->parse_cookies&&"    " request_id->parse_cookies(request_id->misc->moreheads[\"Set-Cookie\"])"    " ->RoxenUserID)||\"0\"", LOG_FLAG_NEED_COOKIES }),    ({ "user", "%s", "extract_user( request_id->realauth )",0 }),    ({ "request-time","%1.2f", "time(request_id->time )",0 }),    ({ "host", "\4711", // unlikely to occur normally    0, LOG_FLAG_ASYNC }),    ({ "cache-status","%s", ("sizeof(request_id->cache_status||({}))?"    "indices(request_id->cache_status)*\",\":"    "\"nocache\""), 0 }), +  ({ "eval-status","%s", ("sizeof(request_id->eval_status||({}))?" +  "indices(request_id->eval_status)*\",\":" +  "\"-\""), 0 }), +  ({ "content-type", "%s", "(file->type||\"-\")", 0 }), +  ({ "server-uptime", "%d", "max(1, time(1) - roxen->start_time)", 0 }), +  ({ "server-cputime", "%d", "server_cputime()", 0 }), +  ({ "server-usertime", "%d", "server_usertime()", 0 }), +  ({ "server-systime", "%d", "server_systime()", 0 }),    ({ "protcache-cost", "%d", "request_id->misc->protcache_cost", 0 }),    ({ "cookies", "%s", ("arrayp(request_id->request_headers->cookie)?"    "request_id->request_headers->cookie*\";\":"    "request_id->request_headers->cookie||\"\""), 0 }),   });      void run_log_format( string fmt, function c, RequestID id, mapping file )   {    (compiled_formats[ fmt ] || compile_log_format( fmt ))(c,id,file);   }