Branch: Tag:

2000-08-17

2000-08-17 01:16:06 by Per Hedbor <ph@opera.com>

Added options to control the RAM cache

Rev: server/protocols/http.pike:1.250
Rev: server/start:1.121

2:   // Modified by Francesco Chemolli to add throttling capabilities.   // Copyright © 1996 - 2000, Roxen IS.    - constant cvs_version = "$Id: http.pike,v 1.249 2000/08/17 00:38:34 per Exp $"; + constant cvs_version = "$Id: http.pike,v 1.250 2000/08/17 01:16:06 per Exp $";   // #define REQUEST_DEBUG   #define MAGIC_ERROR - #define RAM_CACHE +     -  +    #undef OLD_RXML_COMPAT      #ifdef MAGIC_ERROR
1114:      static void do_timeout()   { -  // werror("do_timeout() called, time="+time+"; time()="+_time()+"\n"); -  int elapsed = _time()-time; +  int elapsed = _time(1)-time;    if(time && elapsed >= 30)    {    MARK_FD("HTTP timeout"); -  // Do not under any circumstances send any data as a reply here. -  // This is an easy reason why: It breaks keep-alive totaly. -  // It is not a very good idea to do that, since it might be enabled -  // per deafult any century now.. +     end();    } else {    // premature call_out... *¤#!"
1940:    int tmp;       MARK_FD("HTTP got data"); -  remove_call_out(do_timeout); -  call_out(do_timeout, 30); // Close down if we don't get more data -  // within 30 seconds. Should be more than enough. + // remove_call_out(do_timeout); + // call_out(do_timeout, 30); // Close down if we don't get more data + // // within 30 seconds. Should be more than enough.    time = _time(1); // Check is made towards this to make sure the object    // is not killed prematurely.    if(!raw)
1984:    end();    return;    } -  misc->cacheable = 30; // FIXME: Make configurable. +  misc->cacheable = 300; // FIXME: Make configurable.          mixed q;
2082: Inside #if defined(RAM_CACHE)
   string d = cv[ 0 ];    file = cv[1];    array st; + #ifndef RAM_CACHE_ASUME_STATIC_CONTENT    if( !file->rf || !file->mtime ||    ((st = file_stat( file->rf )) &&    st[ST_MTIME] == file->mtime ) ) -  + #endif    {    conf->hsent += file->hs;    if( strlen( d ) < 4000 )
2192:    if( c ) port_obj = c;    if( cc ) conf = cc;    time = _time(1); -  call_out(do_timeout, 30); +  call_out(do_timeout, 90);   // string q = f->read( 8192, 1 );   // if( q ) got_data( 0, q );    }
2213:    {    // If no pipelined data is available, call out...    remove_call_out(do_timeout); -  call_out(do_timeout, 150); +  call_out(do_timeout, 90);    }       if(!my_fd)