Branch: Tag:

1997-01-29

1997-01-29 06:17:13 by Per Hedbor <ph@opera.com>

removed non-blocking mode in http.pike

Rev: server/protocols/http.pike:1.12

1:   // This is a roxen module. (c) Informationsvävarna AB 1996.       - string cvs_version = "$Id: http.pike,v 1.11 1997/01/29 04:59:45 per Exp $"; + string cvs_version = "$Id: http.pike,v 1.12 1997/01/29 06:17:13 per Exp $";   // HTTP protocol module.   #include <config.h>   inherit "roxenlib";
225:       raw_url = f;    time = _time(1); +     if(!remoteaddr)    {    catch(remoteaddr = ((my_fd->query_address()||"")/" ")[0]);
575: Inside #if defined(KEEP_CONNECTION_ALIVE)
  void keep_connection_alive()   {    pipe=0; -  my_fd->set_nonblocking(got_data, lambda() { }, end); +  my_fd->set_read_callback(got_data); +  my_fd->set_close_callback(end); + /*my_fd->set_write_callback(lambda(){});*/ +     if(cache && strlen(cache))    got_data(1, "");    else
759:    if(conf)    conf->sent+=(file->len>0 ? file->len : 1000);    -  if((file->len<=0 || (file->len > 10000)) +  if((file->len<=0 || (file->len > 30000))    && !keep_alive && objectp(file->file))    {    if(file->data) head_string += file->data;
771:    shuffle( file->file, my_fd );    if(conf)conf->log(file, thiso);    my_fd=file->file=file=pipe=0; -  return; +  destruct();    }       if(!keep_alive && file->len < 3000 && file->len >= 0)    {   // perror("fo\n"); -  if(file->data) head_string += file->data; +  if(file->data) +  head_string += file->data;    if(file->file)    {    head_string += file->file->read(file->len);    destruct(file->file);    } -  file->len=strlen(head_string); +     if(conf) conf->log(file, thiso);    end(head_string);   // perror("end\n");    return;    }    } -  +    // perror("Last case...\n");    if(head_string) send(head_string);    if(file->data) send(file->data);
858:    return;    }   #ifdef THREADS -  my_fd->set_blocking(); + // my_fd->set_blocking();   #endif    if(conf)    {
910:    {    my_fd = f;    my_fd->set_id(0); -  my_fd->set_nonblocking(got_data, lambda(){}, end); +  +  my_fd->set_read_callback(got_data); +  my_fd->set_close_callback(end);    conf = c;    mark_fd(my_fd->query_fd(), "HTTP connection");