]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* Have the HTTP 0.9 / 1.1 processing code reject requests for
authorRuediger Pluem <rpluem@apache.org>
Wed, 10 Jun 2020 11:24:13 +0000 (11:24 +0000)
committerRuediger Pluem <rpluem@apache.org>
Wed, 10 Jun 2020 11:24:13 +0000 (11:24 +0000)
  HTTP >= 2.0 with a HTTP Version Not Support status code.

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

CHANGES
server/protocol.c

diff --git a/CHANGES b/CHANGES
index 0c7b678f12ae66f517ed4276b114d0adb57337dd..c2a72710e9064bd73cbd773dc621d95a1fbdc01e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,7 +1,11 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.1
 
-  *) mod_proxy_http2: the "ping" proxy parameter 
+
+  *) core: Have the HTTP 0.9 / 1.1 processing code reject requests for
+     HTTP >= 2.0 with a HTTP Version Not Support status code. [Ruediger Pluem]
+
+  *) mod_proxy_http2: the "ping" proxy parameter
      (see <https://httpd.apache.org/docs/2.4/mod/mod_proxy.html>) is now used
      when checking the liveliness of a new or reused h2 connection to the backend.
      With short durations, this makes load-balancing more responsive. The module
index 76baabbe291b5b63de990e0f814e541e1c268db0..6eb1786459f09244fbfb077f42d6acc696977615 100644 (file)
@@ -748,7 +748,7 @@ AP_DECLARE(int) ap_parse_request_line(request_rec *r)
     enum {
         rrl_none, rrl_badmethod, rrl_badwhitespace, rrl_excesswhitespace,
         rrl_missinguri, rrl_baduri, rrl_badprotocol, rrl_trailingtext,
-        rrl_badmethod09, rrl_reject09
+        rrl_badmethod09, rrl_reject09, rrl_versionnotsupported
     } deferred_error = rrl_none;
     apr_size_t len = 0;
     char *uri, *ll;
@@ -897,6 +897,11 @@ rrl_done:
         r->proto_num = HTTP_VERSION(0, 9);
     }
 
+    if (strict && deferred_error == rrl_none
+        && r->proto_num >= HTTP_VERSION(2, 0)) {
+        deferred_error = rrl_versionnotsupported;
+    }
+
     /* Determine the method_number and parse the uri prior to invoking error
      * handling, such that these fields are available for substitution
      */
@@ -918,6 +923,7 @@ rrl_done:
      * we can safely resume any deferred error reporting
      */
     if (deferred_error != rrl_none) {
+        r->status = HTTP_BAD_REQUEST;
         if (deferred_error == rrl_badmethod)
             ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(03445)
                           "HTTP Request Line; Invalid method token: '%.*s'",
@@ -954,7 +960,13 @@ rrl_done:
                           "HTTP Request Line; Unrecognized protocol '%.*s' "
                           "(perhaps whitespace was injected?)",
                           field_name_len(r->protocol), r->protocol);
-        r->status = HTTP_BAD_REQUEST;
+        else if (deferred_error == rrl_versionnotsupported) {
+            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO()
+                          "HTTP Request Line; Protocol '%.*s' >= HTTP/2.0 not"
+                          " supported", field_name_len(r->protocol),
+                          r->protocol);
+            r->status = HTTP_VERSION_NOT_SUPPORTED;
+        }
         goto rrl_failed;
     }