Branch: Tag:

2000-08-14

2000-08-14 02:01:46 by Per Hedbor <ph@opera.com>

Some reorganizations and one minor optimization, also a bugfix for the case when there is no data to send (no such file was sowhat broken, and I forgot to check in the fix yesterday)

Rev: server/protocols/http.pike:1.242

2:   // Modified by Francesco Chemolli to add throttling capabilities.   // Copyright © 1996 - 2000, Roxen IS.    - constant cvs_version = "$Id: http.pike,v 1.241 2000/08/13 13:54:22 per Exp $"; + constant cvs_version = "$Id: http.pike,v 1.242 2000/08/14 02:01:46 per Exp $";   // #define REQUEST_DEBUG   #define MAGIC_ERROR   #define RAM_CACHE
1649:    if(!leftovers)    leftovers = data||"";    -  if( !file->from_cache ) -  { +     if(!mappingp(file))    {    misc->cacheable = 0;
1848: Inside #if defined(RAM_CACHE)
   string data = head_string + (file->file?file->file->read(file->len):    (file->data[..file->len-1]));    conf->datacache->set( raw_url, data, -  (["hs":strlen(head_string)]), +  ([ +  "hs":strlen(head_string), +  "len":file->len, +  "error":file->error, +  ]),    misc->cacheable );    file = ([ "data":data ]);    head_string = "";
1879:    send(head_string);    file->len = 1; // Keep those alive, please...    } -  } -  else -  { -  if( strlen( file->data ) < 4000 ) -  { -  conf->hsent += file->hsize; -  my_fd->write( file->data ); -  do_log(); -  return; -  } -  else -  { -  conf->hsent += file->hsize; -  send( file->data ); -  } -  } +     start_sender();   }   
2092: Inside #if defined(RAM_CACHE)
   array cv;    if( misc->cacheable && (cv = conf->datacache->get( raw_url )) )    { +  if(!leftovers) +  leftovers = data||"";    string d = cv[ 0 ]; -  file = ([ "from_cache":1,"len":strlen(d),"hsize":cv[1]->hs,"data":d, ]); +  file = cv[1]; +  conf->hsent += file->hs; +  if( strlen( d ) < 4000 ) +  { +  my_fd->write( d ); +  do_log(); +  } +  else +  { +  send( d );    send_result(); -  +  }    return;    }   #endif