Roxen.git / server / base_server / roxen.pike

version» Context lines:

Roxen.git/server/base_server/roxen.pike:7195:    }       protected string extract_user(string from)    {    array tmp;    if (!from || sizeof(tmp = from/":")<2)    return "-";    return tmp[0]; // username only, no password    }    +  protected string get_forwarded_field(RequestID id, string field) +  { +  foreach(id->misc->forwarded || ({}), array(string|int) segment) { +  if (!arrayp(segment) || sizeof(segment) < 3) continue; +  if (segment[0] != field || segment[1] != '=') continue; +  return MIME.quote(segment[2..]); +  } +  return "-"; +  } +     void log_access( function do_write, RequestID id, mapping file );       void log_event (function do_write, string facility, string action,    string resource, mapping(string:mixed) info);       protected void do_async_write( string host, string data,    string ip, function c )    {    if( c )    c( replace( data, "\4711", (host||ip) ) );
Roxen.git/server/base_server/roxen.pike:7373:    "indices(request_id->cache_status)*\",\":"    "\"nocache\""),    1, "\"-\"", 0}),    "eval-status": ({"%s", ("sizeof(request_id->eval_status||({}))?"    "indices(request_id->eval_status)*\",\":"    "\"-\""),    1, "\"-\"", 0}),    "protcache-cost": ({"%d", "request_id->misc->protcache_cost",    1, "\"-\"", 0}),    "forwarded": ({"%s", ("request_id->misc->forwarded ? " -  "MIME.tokenize(request_id->misc->forwarded) : " -  "\"-\""), +  "MIME.quote(request_id->misc->forwarded *" +  " ({ ',' })) : \"-\""),    1, "\"-\"", 0 }), -  // FIXME: The following ought to use misc->forwarded. -  "xff": ({"%s", ("arrayp(request_id->request_headers[" -  "\"x-forwarded-for\"]) ? " -  "(request_id->request_headers[" -  "\"x-forwarded-for\"][-1] / \",\")[0] :" -  "((request_id->request_headers[" -  "\"x-forwarded-for\"] || \"-\") / \",\")[0]"), +  "xff": ({"%s", "get_forwarded_field(request_id, \"for\")",    1, "\"-\"", 0 }),       // Used for event logging    "facility": ({"-", 0, "%s", "facility", 0}),    "action": ({"-", 0, "%s", "action", 0}),   ]);      void run_log_format( string fmt, function c, RequestID id, mapping file )   {    (compiled_log_access[ fmt ] ||