You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ed Korthof <ed...@organic.com> on 1997/05/25 23:28:44 UTC

[PATCH] Re: PR#601: log entries when request times out

This patch should solve the problem.

I figure that if we haven't set r->method_number, then we haven't reach
the bottom of read_request.  So I created a new method number (M_NONE ==
-1), and set r->method_number to that at the begining of read_request. 
Then, if that is still M_NONE and we got a signal other than SIGPIPE in
timeout(), we can safely say the connection timed out.  I'm not sure how a
SIGPIPE could occur, but what the hell.

Note that this will mean that if the client manages to send a request line
but does not finish sending headers (or simply ommits a blank line at the
end), the log line will include the request line (and any other headers
which are recieved an analyzed -- from what I can see, this occurs after
the following line is recieved). This seems like the correct behavior to
me. 

**********
*** http_main.c.orig2	Sun May 25 13:39:01 1997
--- http_main.c	Sun May 25 14:08:13 1997
***************
*** 421,426 ****
--- 421,431 ----
  	    else log_req = log_req->prev;
  	}
  	
+ /* If we didn't get SIGPIPE and we didn't set the method number,
+  * then it's safe to say the client timed out
+  */
+         if (sig != SIGPIPE && log_req->method_number == M_NONE)
+             log_req->status = HTTP_REQUEST_TIME_OUT;
  	if (!current_conn->keptalive) 
              log_transaction(log_req);
  
*** http_protocol.c.orig4	Sun May 25 13:53:23 1997
--- http_protocol.c	Sun May 25 14:08:43 1997
***************
*** 789,794 ****
--- 789,795 ----
  				 * Only changed by die(), or (bletch!)
  				 * scan_script_header...
  				 */
+     r->method_number = M_NONE;  /* Until we finish reading a request */
  
      /* Get the request... */
      
*** httpd.h.orig2	Sun May 25 13:55:51 1997
--- httpd.h	Sun May 25 14:02:05 1997
***************
*** 357,362 ****
--- 357,363 ----
  
  
  #define METHODS 8
+ #define M_NONE -1
  #define M_GET 0
  #define M_PUT 1
  #define M_POST 2
**********

     -- Ed Korthof        |  Web Server Engineer --
     -- ed@organic.com    |  Organic Online, Inc --
     -- (415) 278-5676    |  Fax: (415) 284-6891 --

On Sun, 25 May 1997, Rob Hartill wrote:

> On Sat, 24 May 1997, Marc Slemko wrote:
> 
> > If a client connects to the server but does not make a request before the
> > Timeout, then a log entry in the form:
> > 
> > alive.znep.com - - [24/May/1997:18:14:33 -0600] "-" 200 -
> > 
> > will be logged.  Note the status 200, which is there because that is what
> > r->status is intialized to.
> > 
> > Should there be extra logic to detect and avoid this case?  Should it
> > use a different status code?  408 or something like -, since it doesn't
> > really send any status code.  Should it just not log an entry?  There is
> > special code for the keepalive case to sensibly not log anything in the
> > access_log for a keepalive timeout.
>  
> 408 sounds right. 
>  
> 
> --
> Rob Hartill                              Internet Movie Database (Ltd)
> http://www.moviedatabase.com/   .. a site for sore eyes.
> 
> 
>