altarch-user / rpms / httpd

Forked from rpms/httpd 2 years ago
Clone

Blame SOURCES/httpd-2.4.6-r1530280.patch

0943f8
--- a/modules/http/http_filters.c	2013/10/08 14:17:33	1530279
0943f8
+++ b/modules/http/http_filters.c	2013/10/08 14:18:44	1530280
0943f8
@@ -825,7 +825,7 @@
0943f8
  * handler.
0943f8
  * Zap r->status_line if bad.
0943f8
  */
0943f8
-static void validate_status_line(request_rec *r)
0943f8
+static apr_status_t validate_status_line(request_rec *r)
0943f8
 {
0943f8
     char *end;
0943f8
 
0943f8
@@ -836,15 +836,19 @@
0943f8
             || (end - 3) != r->status_line
0943f8
             || (len >= 4 && ! apr_isspace(r->status_line[3]))) {
0943f8
             r->status_line = NULL;
0943f8
+            return APR_EGENERAL;
0943f8
         }
0943f8
         /* Since we passed the above check, we know that length three
0943f8
          * is equivalent to only a 3 digit numeric http status.
0943f8
          * RFC2616 mandates a trailing space, let's add it.
0943f8
          */
0943f8
-        else if (len == 3) {
0943f8
+        if (len == 3) {
0943f8
             r->status_line = apr_pstrcat(r->pool, r->status_line, " ", NULL);
0943f8
+            return APR_EGENERAL;
0943f8
         }
0943f8
+        return APR_SUCCESS;
0943f8
     }
0943f8
+    return APR_EGENERAL;
0943f8
 }
0943f8
 
0943f8
 /*
0943f8
@@ -856,15 +860,25 @@
0943f8
 static void basic_http_header_check(request_rec *r,
0943f8
                                     const char **protocol)
0943f8
 {
0943f8
+    apr_status_t rv;
0943f8
+
0943f8
     if (r->assbackwards) {
0943f8
         /* no such thing as a response protocol */
0943f8
         return;
0943f8
     }
0943f8
 
0943f8
-    validate_status_line(r);
0943f8
+    rv = validate_status_line(r);
0943f8
 
0943f8
     if (!r->status_line) {
0943f8
         r->status_line = ap_get_status_line(r->status);
0943f8
+    } else if (rv != APR_SUCCESS) {
0943f8
+        /* Status line is OK but our own reason phrase
0943f8
+         * would be preferred if defined
0943f8
+         */
0943f8
+        const char *tmp = ap_get_status_line(r->status);
0943f8
+        if (!strncmp(tmp, r->status_line, 3)) {
0943f8
+            r->status_line = tmp;
0943f8
+        }
0943f8
     }
0943f8
 
0943f8
     /* Note that we must downgrade before checking for force responses. */