Branch: Tag:

2000-01-30

2000-01-30 21:19:30 by Per Hedbor <ph@opera.com>

Somewhat optimized

Rev: server/protocols/http.pike:1.194

2:   // Modified by Francesco Chemolli to add throttling capabilities.   // Copyright © 1996 - 2000, Idonex AB.    - constant cvs_version = "$Id: http.pike,v 1.193 2000/01/28 13:46:08 nilsson Exp $"; + constant cvs_version = "$Id: http.pike,v 1.194 2000/01/30 21:19:30 per Exp $";      #define MAGIC_ERROR   
1514:    if(file->expires)    heads->Expires = http_date(file->expires);    -  if(mappingp(file->extra_heads)) { +  if(mappingp(file->extra_heads))    heads |= file->extra_heads; -  } +     -  if(mappingp(misc->moreheads)) { +  if(mappingp(misc->moreheads))    heads |= misc->moreheads; -  } +        if(misc->range && file->len && objectp(file->file) && !file->data &&    file->error == 200 && (method == "GET" || method == "HEAD"))
1571:    }       head_string = prot+" "+(file->rettext||errors[file->error])+"\r\n"; -  array tmp_head = ({}); +     foreach(indices(heads), h)    if(arrayp(heads[h]))    foreach(heads[h], tmp) -  tmp_head += ({ `+(h, ": ", tmp) }); +  head_string += h+": "+tmp+"\r\n";    else -  tmp_head += ({ `+(h, ": ", heads[h]) }); -  if(sizeof(tmp_head)) -  head_string += tmp_head * "\r\n" + "\r\n"; +  head_string += h+": "+heads[h]+"\r\n";       if(file->len > -1)    head_string += "Content-Length: "+ file->len +"\r\n";
1880:    my_fd = f;    port_obj = c;    do_not_disconnect=-1; +     MARK_FD("Kept alive");    if(strlen(le))    // More to handle already.    got_data(0,le); -  else { +  else +  {    // If no pipelined data is available, call out...    call_out(do_timeout, 150);    time = _time(1);
1897:    do_not_disconnect=0;    disconnect();    } -  } else { +  } +  else +  {    if(do_not_disconnect == -1)    do_not_disconnect = 0; -  if(!processed) { +  if(!processed) +  {    f->set_close_callback(end);    f->set_read_callback(got_data);    }