altarch-user / rpms / httpd

Forked from rpms/httpd 2 years ago
Clone

Blame SOURCES/httpd-2.4.6-r1530280.patch

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