httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject [PATCH] rfc2068 take 2
Date Thu, 20 Feb 1997 08:46:17 GMT
This patch should address Roy's concern with my previous solution to the
"empty Allow: header" problem.  This changes it so that we always allow
TRACE.  Furthermore, it short-circuits TRACE far earlier in the request
processing in order to ensure that it is efficient, and properly
implemented (i.e. not affected by side-effects of all the various _walk() 
functions and request processing). 

Dean

Index: http_protocol.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_protocol.c,v
retrieving revision 1.103
diff -c -3 -r1.103 http_protocol.c
*** http_protocol.c	1997/02/20 01:23:23	1.103
--- http_protocol.c	1997/02/20 08:41:00
***************
*** 992,1000 ****
  #endif
  }
  
! char *make_allow(request_rec *r)
  {
      int allowed = r->allowed;
  
      return 2 + pstrcat(r->pool, (allowed & (1 << M_GET)) ? ", GET, HEAD" :
"",
  		       (allowed & (1 << M_POST)) ? ", POST" : "",
--- 992,1009 ----
  #endif
  }
  
! static char *make_allow(request_rec *r)
  {
      int allowed = r->allowed;
+ 
+     if( allowed == 0 ) {
+ 	/* RFC2068 #14.7, Allow must contain at least one method.  So rather
+ 	 * than deal with the possibility of trying not to emit an Allow:
+ 	 * header, i.e. #10.4.6 says 405 Method Not Allowed MUST include
+ 	 * an Allow header, we'll just say TRACE is valid.
+ 	 */
+ 	return( "TRACE" );
+     }
  
      return 2 + pstrcat(r->pool, (allowed & (1 << M_GET)) ? ", GET, HEAD" :
"",
  		       (allowed & (1 << M_POST)) ? ", POST" : "",
Index: http_request.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_request.c,v
retrieving revision 1.44
diff -c -3 -r1.44 http_request.c
*** http_request.c	1997/02/17 20:16:16	1.44
--- http_request.c	1997/02/20 08:41:00
***************
*** 870,875 ****
--- 870,884 ----
  	return;
      }
  
+     /* We don't want TRACE to run through the normal handler set,
+      * we handle it specially.
+      */
+     if (r->method_number == M_TRACE) {
+ 	send_http_trace (r);
+ 	finalize_request_protocol (r);
+ 	return;
+     }
+ 
      if (!r->proxyreq)
      {
  	access_status = unescape_url(r->uri);
***************
*** 960,970 ****
  	return;
      }
  
!     /* We don't want TRACE to run through the normal handler set,
!      * we handle it specially.
!      */
!     if (r->method_number == M_TRACE) send_http_trace (r);
!     else if ((access_status = invoke_handler (r)) != 0) {
          die (access_status, r);
  	return;
      }
--- 969,975 ----
  	return;
      }
  
!     if ((access_status = invoke_handler (r)) != 0) {
          die (access_status, r);
  	return;
      }




Mime
View raw message