You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Roy T. Fielding" <fi...@kiwi.ICS.UCI.EDU> on 1997/05/29 03:53:15 UTC

Re: cvs commit: apache/src http_main.c http_protocol.c httpd.h

Ummm, I was just about to veto the logging part of this patch.
It is an unsafe change and a terrible kluge.  Instead, just set
status to HTTP_REQUEST_TIME_OUT until after get_mime_headers is
called.  No big deal and a lot less messy.

....Roy

In message <19...@hyperreal.com>, Jim Jagielski writes:
>jim         97/05/28 16:52:02
>
>  Modified:    src       http_main.c http_protocol.c httpd.h
>  Log:
>  Eds patches which Virtual Hosts on different ports and timeout logging
>  
>  Revision  Changes    Path
>  1.147     +5 -0      apache/src/http_main.c
>  
>  Index: http_main.c
>  ===================================================================
>  RCS file: /export/home/cvs/apache/src/http_main.c,v
>  retrieving revision 1.146
>  retrieving revision 1.147
>  diff -C3 -r1.146 -r1.147
>  *** http_main.c	1997/05/27 04:41:50	1.146
>  --- http_main.c	1997/05/28 23:51:57	1.147
>  ***************
>  *** 415,420 ****
>  --- 415,425 ----
>    	    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);
>    
>  
>  
>  
>  1.124     +3 -1      apache/src/http_protocol.c
>  
>  Index: http_protocol.c
>  ===================================================================
>  RCS file: /export/home/cvs/apache/src/http_protocol.c,v
>  retrieving revision 1.123
>  retrieving revision 1.124
>  diff -C3 -r1.123 -r1.124
>  *** http_protocol.c	1997/05/27 04:41:51	1.123
>  --- http_protocol.c	1997/05/28 23:51:58	1.124
>  ***************
>  *** 711,717 ****
>    
>        /* search all the names from <VirtualHost> directive */
>        for( sar = s->addrs; sar; sar = sar->next ) {
>  !       if( !strcasecmp( sar->virthost, host ) ) {
>    	r->server = r->connection->server = s;
>    	if( r->hostlen && !strncmp( r->uri, "http://", 7) ) {
>    	  r->uri += r->hostlen;
>  --- 711,718 ----
>    
>        /* search all the names from <VirtualHost> directive */
>        for( sar = s->addrs; sar; sar = sar->next ) {
>  !       if( !strcasecmp( sar->virthost, host ) &&
>  !        ( (sar->host_port == 0) || (port == sar->host_port) )) {
>    	r->server = r->connection->server = s;
>    	if( r->hostlen && !strncmp( r->uri, "http://", 7) ) {
>    	  r->uri += r->hostlen;
>  ***************
>  *** 789,794 ****
>  --- 790,796 ----
>    				 * Only changed by die(), or (bletch!)
>    				 * scan_script_header...
>    				 */
>  +     r->method_number = M_NONE;  /* Until we finish reading a request */
>    
>        /* Get the request... */
>        
>  
>  
>  
>  1.106     +1 -0      apache/src/httpd.h
>  
>  Index: httpd.h
>  ===================================================================
>  RCS file: /export/home/cvs/apache/src/httpd.h,v
>  retrieving revision 1.105
>  retrieving revision 1.106
>  diff -C3 -r1.105 -r1.106
>  *** httpd.h	1997/05/27 04:41:49	1.105
>  --- httpd.h	1997/05/28 23:51:59	1.106
>  ***************
>  *** 347,352 ****
>  --- 347,353 ----
>    
>    
>    #define METHODS 8
>  + #define M_NONE -1
>    #define M_GET 0
>    #define M_PUT 1
>    #define M_POST 2
>  
>  
>  


Re: cvs commit: apache/src http_main.c http_protocol.c httpd.h

Posted by Ed Korthof <ed...@organic.com>.
<shrug> As I indicated in the note which went along, it's completely
impossible to get out of read_request w/o setting status to something
else, or closing the connection entirely, so this is safe with the current
code.  It'd be a very bad idea to use the method_number before it's set;
and no matter what, it is set to something at the bottom of read_request. 

OTOH, doing it as you describe makes sense.

**********  
*** http_protocol.c.orig2	Wed May 28 20:44:26 1997
--- http_protocol.c	Wed May 28 20:43:53 1997
***************
*** 786,792 ****
      r->read_length  = 0;
      r->read_body    = REQUEST_NO_BODY;
      
!     r->status = HTTP_OK;	/* Until further notice.
  				 * Only changed by die(), or (bletch!)
  				 * scan_script_header...
  				 */
--- 786,792 ----
      r->read_length  = 0;
      r->read_body    = REQUEST_NO_BODY;
      
!     r->status = HTTP_REQUEST_TIME_OUT; /* Until we finish reading the request
  				 * Only changed by die(), or (bletch!)
  				 * scan_script_header...
  				 */
***************
*** 803,808 ****
--- 803,809 ----
          get_mime_headers (r);
      }
      kill_timeout(r);
+     r->status = HTTP_OK;
  
      /* handle Host header here, to get virtual server */
**********  


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

On Wed, 28 May 1997, Roy T. Fielding wrote:

> Ummm, I was just about to veto the logging part of this patch.
> It is an unsafe change and a terrible kluge.  Instead, just set
> status to HTTP_REQUEST_TIME_OUT until after get_mime_headers is
> called.  No big deal and a lot less messy.
> 
> ....Roy
> 
> In message <19...@hyperreal.com>, Jim Jagielski writes:
> >jim         97/05/28 16:52:02
> >
> >  Modified:    src       http_main.c http_protocol.c httpd.h
> >  Log:
> >  Eds patches which Virtual Hosts on different ports and timeout logging
> >  
> >  Revision  Changes    Path
> >  1.147     +5 -0      apache/src/http_main.c
> >  
> >  Index: http_main.c
> >  ===================================================================
> >  RCS file: /export/home/cvs/apache/src/http_main.c,v
> >  retrieving revision 1.146
> >  retrieving revision 1.147
> >  diff -C3 -r1.146 -r1.147
> >  *** http_main.c	1997/05/27 04:41:50	1.146
> >  --- http_main.c	1997/05/28 23:51:57	1.147
> >  ***************
> >  *** 415,420 ****
> >  --- 415,425 ----
> >    	    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);
> >    
> >  
> >  
> >  
> >  1.124     +3 -1      apache/src/http_protocol.c
> >  
> >  Index: http_protocol.c
> >  ===================================================================
> >  RCS file: /export/home/cvs/apache/src/http_protocol.c,v
> >  retrieving revision 1.123
> >  retrieving revision 1.124
> >  diff -C3 -r1.123 -r1.124
> >  *** http_protocol.c	1997/05/27 04:41:51	1.123
> >  --- http_protocol.c	1997/05/28 23:51:58	1.124
> >  ***************
> >  *** 711,717 ****
> >    
> >        /* search all the names from <VirtualHost> directive */
> >        for( sar = s->addrs; sar; sar = sar->next ) {
> >  !       if( !strcasecmp( sar->virthost, host ) ) {
> >    	r->server = r->connection->server = s;
> >    	if( r->hostlen && !strncmp( r->uri, "http://", 7) ) {
> >    	  r->uri += r->hostlen;
> >  --- 711,718 ----
> >    
> >        /* search all the names from <VirtualHost> directive */
> >        for( sar = s->addrs; sar; sar = sar->next ) {
> >  !       if( !strcasecmp( sar->virthost, host ) &&
> >  !        ( (sar->host_port == 0) || (port == sar->host_port) )) {
> >    	r->server = r->connection->server = s;
> >    	if( r->hostlen && !strncmp( r->uri, "http://", 7) ) {
> >    	  r->uri += r->hostlen;
> >  ***************
> >  *** 789,794 ****
> >  --- 790,796 ----
> >    				 * Only changed by die(), or (bletch!)
> >    				 * scan_script_header...
> >    				 */
> >  +     r->method_number = M_NONE;  /* Until we finish reading a request */
> >    
> >        /* Get the request... */
> >        
> >  
> >  
> >  
> >  1.106     +1 -0      apache/src/httpd.h
> >  
> >  Index: httpd.h
> >  ===================================================================
> >  RCS file: /export/home/cvs/apache/src/httpd.h,v
> >  retrieving revision 1.105
> >  retrieving revision 1.106
> >  diff -C3 -r1.105 -r1.106
> >  *** httpd.h	1997/05/27 04:41:49	1.105
> >  --- httpd.h	1997/05/28 23:51:59	1.106
> >  ***************
> >  *** 347,352 ****
> >  --- 347,353 ----
> >    
> >    
> >    #define METHODS 8
> >  + #define M_NONE -1
> >    #define M_GET 0
> >    #define M_PUT 1
> >    #define M_POST 2
> >  
> >  
> >  
> 
> 
>