Roxen.git / server / plugins / protocols / http.pike

version» Context lines:

Roxen.git/server/plugins/protocols/http.pike:1:   // This is a roxen protocol module.   // Modified by Francesco Chemolli to add throttling capabilities.   // Copyright © 1996 - 2001, Roxen IS.    - constant cvs_version = "$Id: http.pike,v 1.378 2002/07/04 18:47:33 nilsson Exp $"; + constant cvs_version = "$Id: http.pike,v 1.379 2002/07/05 02:10:36 nilsson Exp $";   // #define REQUEST_DEBUG   #define MAGIC_ERROR      // HTTP protocol module.   #include <config.h>   #define TIMER_PREFIX "http:"   #include <timers.h>      inherit RequestID;   
Roxen.git/server/plugins/protocols/http.pike:125:    }   }      AuthEmulator auth;      array(string) output_charset = ({});   string input_charset;      void set_output_charset( string|function to, int|void mode )   { -  if( search( output_charset, to ) != -1 ) // Already done. +  if( has_value( output_charset, to ) ) // Already done.    return;       switch( mode )    {    case 0: // Really set.    output_charset = ({ to });    break;       case 1: // Only set if not already set.    if( !sizeof( output_charset ) )
Roxen.git/server/plugins/protocols/http.pike:236:    }    else    return ({    0,    Locale.Charset.encoder( (force_charset/"=")[-1] )->feed( what )->drain()    });   }      void decode_map( mapping what, function decoder )   { -  foreach( indices( what ), mixed q ) +  foreach( what; mixed q; mixed val )    {    string ni; -  mixed val; +     if( stringp( q ) )    catch { ni = decoder( q ); }; -  val = what[q]; +     if( stringp( val ) )    catch { val = decoder( val ); };    else if( arrayp( val ) )    val = map( val, lambda( mixed q ) {    if( stringp( q ) )    catch { return decoder( q ); };    return q;    } );    else if( mappingp( val ) )    decode_map( val, decoder );
Roxen.git/server/plugins/protocols/http.pike:588:    }    }       string f = raw_url;          f = scan_for_query( f );    f = http_decode_string( f );       // f is sent to Unix API's that take NUL-terminated strings... -  if(search(f, "\0") != -1) +  if( has_value(f, "\0") )    sscanf(f, "%s\0", f);       if( strlen( f ) > 5 )    {    string a;    switch( f[1] )    {   #ifdef OLD_RXML_CONFIG    case '<':    if (sscanf(f, "/<%s>/%s", a, f)==2)
Roxen.git/server/plugins/protocols/http.pike:1624:       if(prot != "HTTP/0.9")    {    string h, charset="";       if( stringp(file->data) )    {    if (file["type"][0..4] == "text/")    {    [charset,file->data] = output_encode( file->data, 1 ); -  if( charset && (search(file["type"], "; charset=") == -1)) +  if( charset && has_value(file["type"], "; charset=") )    charset = "; charset="+charset;    else    charset = "";    }    file->len = strlen(file->data);    }    heads["Content-Type"] = file["type"]+charset;    heads["Accept-Ranges"] = "bytes";    heads["Server"] = replace(version(), " ", "·");    if( misc->connection )
Roxen.git/server/plugins/protocols/http.pike:1711:    // Some browsers, e.g. Netscape 4.7, doesn't trust a zero    // content length when using keep-alive. So let's force a    // close in that case.    if( file->error/100 == 2 && file->len <= 0 )    {    heads->Connection = "close";    misc->connection = "close";    }    if( catch( head_string += Roxen.make_http_headers( heads ) ) )    { -  foreach( indices( heads ), string x ) -  if( stringp( heads[x] ) ) -  head_string += x+": "+heads[x]+"\r\n"; -  else if( arrayp( heads[x] ) ) -  foreach( heads[x], string xx ) +  foreach( heads; string x; mixed head ) +  if( stringp( head ) ) +  head_string += x+": "+head+"\r\n"; +  else if( arrayp( head ) ) +  foreach( head, string xx )    head_string += x+": "+xx+"\r\n";    else if( catch { -  head_string += x+": "+(string)heads[x]; +  head_string += x+": "+(string)head;    } )    error("Illegal value in headers array! "    "Expected string or array(string)\n");    head_string += "\r\n";    }       if( strlen( charset ) || String.width( head_string ) > 8 )    head_string = output_encode( head_string, 0, charset )[1];    conf->hsent += strlen(head_string);    }