Branch: Tag:

1997-01-29

1997-01-29 07:40:53 by Per Hedbor <ph@opera.com>

Fixes again...

Rev: server/base_server/roxen.pike:1.35
Rev: server/protocols/http.pike:1.15

1:   // This is a roxen module. (c) Informationsv√§varna AB 1996.       - string cvs_version = "$Id: http.pike,v 1.14 1997/01/29 06:39:12 per Exp $"; + string cvs_version = "$Id: http.pike,v 1.15 1997/01/29 07:40:53 per Exp $";   // HTTP protocol module.   #include <config.h>   inherit "roxenlib";
85:   {    if(!my_fd) return end();    if(!pipe) pipe=((program)"/precompiled/pipe")(); -  if(!noend) pipe->set_done_callback(end); +    #ifdef REQUEST_DEBUG    perror("REQUEST: Pipe setup.\n");   #endif
612:   static void handle_request( )   {    mixed *err; -  int tmp, keep_alive; +  int tmp; + #ifdef KEEP_CONNECTION_ALIVE +  int keep_alive; + #endif    function funp;    mapping heads; -  string head_string, tmp2, tmp3; +  string head_string;    object thiso=this_object(); -  +    #ifndef SPEED_MAX    remove_call_out(timeout);   #endif
745:    head_string = (myheads+({"",""}))*"\r\n";       if(conf)conf->hsent+=strlen(head_string||""); +  my_fd->set_read_callback(0); +  my_fd->set_close_callback(0); +     if(method=="HEAD")    {    if(conf)conf->log(file, thiso); -  + #ifdef KEEP_CONNECTION_ALIVE    if(keep_alive)    {    my_fd->write(head_string);    misc->connection = 0; - #ifdef KEEP_CONNECTION_ALIVE +     keep_connection_alive(); -  +  } else   #endif -  } else { +     end(head_string); -  } +     return;    }       if(conf)    conf->sent+=(file->len>0 ? file->len : 1000);    -  if((file->len<=0 || (file->len > 30000)) -  && !keep_alive && objectp(file->file)) +  if(!file->data && +  (file->len<=0 || (file->len > 30000)) + #ifdef KEEP_CONNECTION_ALIVE +  && !keep_alive + #endif +  && objectp(file->file))    { -  if(file->data) head_string += file->data; -  if(head_string) -  { -  my_fd->write(head_string); -  head_string=0; -  } +  if(head_string) my_fd->write(head_string);    shuffle( file->file, my_fd );    if(conf)conf->log(file, thiso);    my_fd=file->file=file=pipe=0; -  destruct(); +  destruct(thiso); +  return;    }    -  if(!keep_alive && file->len < 3000 && file->len >= 0) +  if(file->len < 3000 && + #ifdef KEEP_CONNECTION_ALIVE +  !keep_alive && + #endif +  file->len >= 0)    {   // perror("fo\n");    if(file->data)
796:    }    }    - // perror("Last case...\n"); + perror("Last case...\n");    if(head_string) send(head_string);    if(file->data) send(file->data);    if(file->file) send(file->file);
814: Inside #if defined(KEEP_CONNECTION_ALIVE)
   }    } else   #endif +  {    my_fd=0;    pipe=file=0; -  +  destruct(thiso);    } -  + }      /* We got some data on a socket.    * =================================================
863:    end();    return;    } - #ifdef THREADS - // my_fd->set_blocking(); - #endif +     if(conf)    {    conf->received += strlen(s);
915:    if(f)    {    my_fd = f; -  my_fd->set_id(0); -  +     my_fd->set_read_callback(got_data);    my_fd->set_close_callback(end);    conf = c;