]> granicus.if.org Git - apache/commitdiff
Merge r1529014 from trunk:
authorJim Jagielski <jim@apache.org>
Tue, 8 Oct 2013 14:18:44 +0000 (14:18 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 8 Oct 2013 14:18:44 +0000 (14:18 +0000)
core: Add missing Reason-Phrase in HTTP response headers.
PR 54946.

Submitted by: rjung
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1530280 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/http/http_filters.c

diff --git a/CHANGES b/CHANGES
index 34becc03ef525db7a706e830b817bbca584042e4..55cc9c95cd38c7cf46aa61fa6f362c87c55d02b7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.4.7
 
+  *) core: Add missing Reason-Phrase in HTTP response headers.
+     PR 54946. [Rainer Jung]
+
   *) mod_rewrite: Make rewrite websocket aware to allow proxying.
      PR 55598. [Chris Harris <chris.harris kitware com>]
 
diff --git a/STATUS b/STATUS
index 074f2aaba8b5ed89a6a30e3f9d340bff0e12def2..5a6f0e4a15d42f18a93dcfe2aa1dadb37beed033 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -103,11 +103,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
     2.4.x patch: http://people.apache.org/~druggeri/patches/SessionCryptoPassphrase-exec.2.4.x.patch
     +1: druggeri, rjung, jim
 
-  * core: Add missing Reason-Phrase in HTTP response headers.
-    PR 54946.
-    trunk patches: https://svn.apache.org/r1529014
-    2.4.x: trunk works modulo CHANGES
-    +1: rjung, covener, jim
 
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
index 24a939a45c06b9143745f8af4199b88d846b87cf..c72741945372357a1678533c05722f620d4f4b37 100644 (file)
@@ -825,7 +825,7 @@ static apr_status_t send_all_header_fields(header_struct *h,
  * handler.
  * Zap r->status_line if bad.
  */
-static void validate_status_line(request_rec *r)
+static apr_status_t validate_status_line(request_rec *r)
 {
     char *end;
 
@@ -836,15 +836,19 @@ static void validate_status_line(request_rec *r)
             || (end - 3) != r->status_line
             || (len >= 4 && ! apr_isspace(r->status_line[3]))) {
             r->status_line = NULL;
+            return APR_EGENERAL;
         }
         /* Since we passed the above check, we know that length three
          * is equivalent to only a 3 digit numeric http status.
          * RFC2616 mandates a trailing space, let's add it.
          */
-        else if (len == 3) {
+        if (len == 3) {
             r->status_line = apr_pstrcat(r->pool, r->status_line, " ", NULL);
+            return APR_EGENERAL;
         }
+        return APR_SUCCESS;
     }
+    return APR_EGENERAL;
 }
 
 /*
@@ -856,15 +860,25 @@ static void validate_status_line(request_rec *r)
 static void basic_http_header_check(request_rec *r,
                                     const char **protocol)
 {
+    apr_status_t rv;
+
     if (r->assbackwards) {
         /* no such thing as a response protocol */
         return;
     }
 
-    validate_status_line(r);
+    rv = validate_status_line(r);
 
     if (!r->status_line) {
         r->status_line = ap_get_status_line(r->status);
+    } else if (rv != APR_SUCCESS) {
+        /* Status line is OK but our own reason phrase
+         * would be preferred if defined
+         */
+        const char *tmp = ap_get_status_line(r->status);
+        if (!strncmp(tmp, r->status_line, 3)) {
+            r->status_line = tmp;
+        }
     }
 
     /* Note that we must downgrade before checking for force responses. */