]> granicus.if.org Git - apache/commitdiff
core: Add missing Reason-Phrase in HTTP response headers.
authorRainer Jung <rjung@apache.org>
Thu, 3 Oct 2013 21:50:07 +0000 (21:50 +0000)
committerRainer Jung <rjung@apache.org>
Thu, 3 Oct 2013 21:50:07 +0000 (21:50 +0000)
PR 54946.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1529014 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/http/http_filters.c

diff --git a/CHANGES b/CHANGES
index a49242f5f976b267d2049e7c2977e8ca94fc0fd0..fc7c3c1cc534c3bdd9f175d3e005c3aa59269f5c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) 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>]
 
index ee01cf4b4c5cc2dcf0b2134dcfd60bd4b5a00f31..38d326b5431289e7b06824693bd314e0aad0f4f2 100644 (file)
@@ -760,7 +760,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;
 
@@ -771,15 +771,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;
 }
 
 /*
@@ -791,15 +795,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. */