Branch: Tag:

2000-11-13

2000-11-13 15:08:49 by Per Hedbor <ph@opera.com>

Fixed [Bug 699 (#699)]

Rev: server/base_server/roxen.pike:1.572
Rev: server/protocols/fhttp.pike:2.12(DEAD)
Rev: server/protocols/gopher.pike:1.17(DEAD)
Rev: server/protocols/hilfe.pike:2.5(DEAD)
Rev: server/protocols/http.pike:1.286
Rev: server/protocols/prot_fhttp.pike:2.1
Rev: server/protocols/prot_ftp.pike:2.1
Rev: server/protocols/prot_ftps.pike:2.1
Rev: server/protocols/prot_hilfe.pike:2.1
Rev: server/protocols/prot_http.pike:2.1
Rev: server/protocols/prot_https.pike:2.1
Rev: server/protocols/prot_tetris.pike:2.1

2:   // Modified by Francesco Chemolli to add throttling capabilities.   // Copyright © 1996 - 2000, Roxen IS.    - constant cvs_version = "$Id: http.pike,v 1.285 2000/11/05 21:26:25 nilsson Exp $"; + constant cvs_version = "$Id: http.pike,v 1.286 2000/11/13 15:08:47 per Exp $";   // #define REQUEST_DEBUG   #define MAGIC_ERROR   
996:      void end(int|void keepit)   { - #ifdef PROFILE -  float elapsed = SECHR(HRTIME()-req_time); -  string nid = - #ifdef FILE_PROFILE -  not_query - #else -  dirname(not_query) - #endif -  ; -  array p; -  if(!(p=conf->profile_map[nid])) -  p = conf->profile_map[nid] = ({0,0.0,0.0}); -  p[0]++; -  p[1] += elapsed; -  if(elapsed > p[2]) p[2]=elapsed; - #endif -  +     if(keepit    && !file->raw    && (misc->connection == "keep-alive" ||
1579:    if (result)    file = result;    + #ifdef PROFILE +  float elapsed = SECHR(HRTIME()-req_time); +  string nid = + #ifdef FILE_PROFILE +  (raw_url/"?")[0] + #else +  dirname((raw_url/"?")[0]) + #endif +  ; +  array p; +  if(!(p=conf->profile_map[nid])) +  p = conf->profile_map[nid] = ({0,0.0,0.0}); +  p[0]++; +  p[1] += elapsed; +  if(elapsed > p[2]) p[2]=elapsed; + #endif +     REQUEST_WERR(sprintf("HTTP: send_result(%O)", file));      
1908:    * =================================================    */   int processed; + // array ccd = ({});   void got_data(mixed fooid, string s)   {    ITIMER();    TIMER("got_data");    -  // The port has been closed, but old (probably keep-alive -  // connections remain. Close those connections. -  if( !port_obj ) +  if(wanted_data)    { -  catch // paranoia +  werror(" Wanted: %d; have: %d\n", wanted_data, have_data ); + // ccd += ({ s }); +  data += s; +  if(strlen(s) + have_data < wanted_data)    { -  my_fd->close(); -  destruct( my_fd ); -  destruct( ); -  }; +  // cache += ({ s }); +  have_data += strlen(s); +  REQUEST_WERR("HTTP: We want more data.");    return;    } -  + // data += ccd*""; +  }       if (mixed err = catch { -  +     int tmp;       MARK_FD("HTTP got data");
1935:   // // is not killed prematurely.    if(!raw) raw = s; else raw += s;    -  if(wanted_data) +  +  // The port has been closed, but old (probably keep-alive +  // connections remain. Close those connections. +  if( !port_obj )    { -  data += s; -  if(strlen(s) + have_data < wanted_data) +  catch // paranoia    { -  // cache += ({ s }); -  have_data += strlen(s); -  REQUEST_WERR("HTTP: We want more data."); +  my_fd->close(); +  destruct( my_fd ); +  destruct( ); +  };    return;    } -  } +        if(strlen(raw))    tmp = parse_got( s );