httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r1529014 - in /httpd/httpd/trunk: CHANGES modules/http/http_filters.c
Date Thu, 03 Oct 2013 21:50:08 GMT
Author: rjung
Date: Thu Oct  3 21:50:07 2013
New Revision: 1529014

URL: http://svn.apache.org/r1529014
Log:
core: Add missing Reason-Phrase in HTTP response headers.
PR 54946.

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

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1529014&r1=1529013&r2=1529014&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Thu Oct  3 21:50:07 2013
@@ -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>]
 

Modified: httpd/httpd/trunk/modules/http/http_filters.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http/http_filters.c?rev=1529014&r1=1529013&r2=1529014&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http/http_filters.c (original)
+++ httpd/httpd/trunk/modules/http/http_filters.c Thu Oct  3 21:50:07 2013
@@ -760,7 +760,7 @@ static apr_status_t send_all_header_fiel
  * 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
             || (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
 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. */



Mime
View raw message