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.410 2004/06/06 11:04:02 _cvs_stephen Exp $"; + constant cvs_version = "$Id: http.pike,v 1.411 2004/06/19 23:59:22 _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>
Roxen.git/server/plugins/protocols/http.pike:249:    pipe->add_source(what,start,len||sizeof(what));   }      void start_sender( )   {   #ifdef FD_DEBUG    call_out(timer, 30, predef::time(1)); // Update FD with time...   #endif    if( throttler || conf->throttler )    pipe->set_throttler( throttler || conf->throttler ); -  pipe->set_done_callback( do_log ); +  pipe->set_done_callback( shuff_do_log );    pipe->start( );    data_buffer = 0;    pipe = 0;   }      string scan_for_query( string f )   {    query=0;    rest_query="";    if(sscanf(f,"%s?%s", f, query) == 2)
Roxen.git/server/plugins/protocols/http.pike:1054:    if (mixed __eRr = catch (internal_error (err))) \    report_error("Internal server error: " + describe_backtrace(err) + \    "internal_error() also failed: " + describe_backtrace(__eRr)); \    } while (0)      int wants_more()   {    return !!cache;   }    - void do_log( Shuffler.Shuffle r, int reason ) + void do_log(int fsent)   {    MARK_FD("HTTP logging"); // fd can be closed here -  int fsent = r->sent_data(); +        TIMER_START(do_log);    if(conf)    {    conf->sent+=fsent;    file->len += misc->_log_cheat_addition;    conf->log(file, this);    }       if( !port_obj )
Roxen.git/server/plugins/protocols/http.pike:1081:    if( conf )    conf->connection_drop( this );    call_out (disconnect, 0);    return;    }    TIMER_END(do_log);    end(1);    return;   }    + void shuff_do_log(Shuffler.Shuffle r, int reason) { +  do_log(r->sent_data()); + } +    #ifdef FD_DEBUG   void timer(int start)   {    if(pipe) {    // FIXME: Disconnect if no data has been sent for a long while    // (30min?)    MARK_FD(sprintf("HTTP piping %d %d %d %d (%s)",    pipe->sent,    stringp(pipe->current_input) ?    sizeof(pipe->current_input) : -1,
Roxen.git/server/plugins/protocols/http.pike:1623: 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); +  do_log(s);    return;    }    if(sizeof(head_string)) send(head_string);    if(file->data && sizeof(file->data)) send(file->data, file->len);    if(file->file) send(file->file, file->len);    }    else    {    if( sizeof( head_string ) < (HTTP_BLOCKING_SIZE_THRESHOLD))    {   #ifdef CONNECTION_DEBUG    werror ("HTTP: Response =================================================\n"    "%s\n",    replace (sprintf ("%O", head_string),    ({"\\r\\n", "\\n", "\\t"}),    ({"\n", "\n", "\t"})));   #else    REQUEST_WERR (sprintf ("HTTP: Send headers blocking %O", head_string));   #endif -  +  do_log(my_fd->write(head_string));    return;    }    send(head_string);    file->len = 1; // Keep those alive, please...    }    TIMER_END(send_result);    start_sender();   }      // Execute the request
Roxen.git/server/plugins/protocols/http.pike:2020: Inside #if defined(RAM_CACHE)
   return headers;    };       MY_TRACE_LEAVE ("Using entry from ram cache");    conf->hsent += sizeof(file->hs);    cache_status["protcache"] = 1;    d=fix_date(file->hs)+d;    if( sizeof( d ) < (HTTP_BLOCKING_SIZE_THRESHOLD) )    {    TIMER_END(cache_lookup); -  my_fd->write(d); +  do_log(my_fd->write(d));    }    else    {    TIMER_END(cache_lookup);    send(d); -  start_sender( ); +  start_sender();    }    return;    }   #ifndef RAM_CACHE_ASUME_STATIC_CONTENT    else    MY_TRACE_LEAVE (    sprintf ("Entry out of date (disk: %s, cache: mtime %d)",    st ? "mtime " + st->mtime : "gone", file->mtime));   #endif    } else