httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r379562 - in /httpd/httpd/trunk: CHANGES modules/http/http_filters.c
Date Tue, 21 Feb 2006 19:34:37 GMT
Author: trawick
Date: Tue Feb 21 11:34:33 2006
New Revision: 379562

URL: http://svn.apache.org/viewcvs?rev=379562&view=rev
Log:
Ensure that the proper status line is written to the client, fixing
incorrect status lines caused by filters which modify r->status without
resetting r->status_line, such as the built-in byterange filter.

Note: For the byterange example, the handler must set r->status_line
even though this is a 200 response.  Some proxy-type modules blindly
set r->status_line as set by the origin server and thus trigger
the problem with byteranges if the origin server didn't handle the
byterange.


Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/http/http_filters.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/CHANGES?rev=379562&r1=379561&r2=379562&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Tue Feb 21 11:34:33 2006
@@ -2,6 +2,11 @@
 Changes with Apache 2.3.0
   [Remove entries to the current 2.0 and 2.2 section below, when backported]
 
+  *) Ensure that the proper status line is written to the client, fixing
+     incorrect status lines caused by filters which modify r->status without 
+     resetting r->status_line, such as the built-in byterange filter.
+     [Jeff Trawick]
+
   *) mod_ssl: Fix spurious hostname mismatch warning for valid
      wildcard certificates.  PR 37911.  [Nick Burch <nick torchbox.com>]
 

Modified: httpd/httpd/trunk/modules/http/http_filters.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/http/http_filters.c?rev=379562&r1=379561&r2=379562&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http/http_filters.c (original)
+++ httpd/httpd/trunk/modules/http/http_filters.c Tue Feb 21 11:34:33 2006
@@ -628,6 +628,24 @@
 #endif
 }
 
+/* Confirm that the status line is well-formed and matches r->status.
+ * If they don't match, a filter may have negated the status line set by a
+ * handler.
+ * Zap r->status_line if bad.
+ */
+static void validate_status_line(request_rec *r)
+{
+    char *end;
+
+    if (r->status_line
+        && (strlen(r->status_line) <= 4
+            || apr_strtoi64(r->status_line, &end, 10) != r->status
+            || *end != ' '
+            || (end - 3) != r->status_line)) {
+        r->status_line = NULL;
+    }
+}
+
 /*
  * Determine the protocol to use for the response. Potentially downgrade
  * to HTTP/1.0 in some situations and/or turn off keepalives.
@@ -641,6 +659,8 @@
         /* no such thing as a response protocol */
         return;
     }
+
+    validate_status_line(r);
 
     if (!r->status_line) {
         r->status_line = ap_get_status_line(r->status);



Mime
View raw message