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

version» Context lines:

Roxen.git/server/plugins/protocols/http.pike:1:   // This is a ChiliMoon protocol module.   // Modified by Francesco Chemolli to add throttling capabilities.   // Copyright © 1996 - 2001, Roxen IS.    - constant cvs_version = "$Id: http.pike,v 1.405 2004/05/31 23:02:02 _cvs_stephen Exp $"; - // #define REQUEST_DEBUG + constant cvs_version = "$Id: http.pike,v 1.406 2004/06/03 02:52:07 _cvs_stephen Exp $"; + //#define REQUEST_DEBUG + //#define CONNECTION_DEBUG   #define MAGIC_ERROR -  + #define HTTPTIMEOUT 90      // HTTP protocol module.   #include <config.h>   #define TIMER_PREFIX "http:"   #include <timers.h>   #include <stat.h>      inherit RequestID;      #ifdef PROFILE
Roxen.git/server/plugins/protocols/http.pike:861:    }       data_buffer = 0;    pipe = 0;    disconnect();   }      static void do_timeout()   {    int elapsed = predef::time(1)-time; -  if(time && elapsed >= 30) +  if(time && elapsed >= HTTPTIMEOUT/3)    {    REQUEST_WERR("HTTP: Connection timed out. Closing.");    MARK_FD("HTTP timeout");    end();    } else {   #ifdef DEBUG    error ("This shouldn't happen.\n");   #endif    // premature call_out... *¤#!"    call_out(do_timeout, 10);
Roxen.git/server/plugins/protocols/http.pike:1706: Inside #if defined(CONNECTION_DEBUG)
   werror ("HTTP: Response =================================================\n"    "%s\n",    replace (sprintf ("%O", data),    ({"\\r\\n", "\\n", "\\t"}),    ({"\n", "\n", "\t"})));   #else    REQUEST_WERR (sprintf ("HTTP: Send blocking %O", data));   #endif    s = my_fd->write(data);    TIMER_END(blocking_write); +  end(1);    return;    }    if(strlen(head_string)) send(head_string);    if(file->data && strlen(file->data)) send(file->data, file->len);    if(file->file) send(file->file, file->len);    }    else    {    if( strlen( head_string ) < (HTTP_BLOCKING_SIZE_THRESHOLD))    {
Roxen.git/server/plugins/protocols/http.pike:1880:    // avoid having to realloc.    data_buffer = String.Buffer(wanted_data + 16384);    data_buffer->add(data);    data = "";    }    data_buffer->add(s);    have_data += strlen(s);       // Reset timeout.    remove_call_out(do_timeout); -  call_out(do_timeout, 90); +  call_out(do_timeout, HTTPTIMEOUT);    REQUEST_WERR("HTTP: We want more data.");    return;    }    if(data_buffer) {    data_buffer->add(s);    data = (string)data_buffer;    data_buffer = 0;    }    else    data += s;
Roxen.git/server/plugins/protocols/http.pike:2217:   {    if(f)    {    f->set_nonblocking(got_data, f->query_write_callback(), end);    my_fd = f;    CHECK_FD_SAFE_USE;    MARK_FD("HTTP connection");    if( c ) port_obj = c;    if( cc ) conf = cc;    time = predef::time(1); -  call_out(do_timeout, 90); +  call_out(do_timeout, HTTPTIMEOUT);    }    root_id = this;   }      void chain( object f, object c, string le )   {    my_fd = f;    f->set_nonblocking(0, f->query_write_callback(), end);    port_obj = c;    processed = 0;    do_not_disconnect=-1; // Block destruction until we return.    MARK_FD("HTTP kept alive");    time = predef::time();       if ( le && strlen( le ) )    got_data( 0,le );    else    {    // If no pipelined data is available, call out...    remove_call_out(do_timeout); -  call_out(do_timeout, 90); +  call_out(do_timeout, HTTPTIMEOUT);    }       if(!my_fd)    {    if(do_not_disconnect == -1)    {    do_not_disconnect=0;    disconnect();    }    }