You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2020/06/19 11:45:16 UTC

svn commit: r1878985 - in /httpd/httpd/trunk: CHANGES modules/http2/h2_request.c server/protocol.c

Author: rpluem
Date: Fri Jun 19 11:45:16 2020
New Revision: 1878985

URL: http://svn.apache.org/viewvc?rev=1878985&view=rev
Log:
* Revert r1878939, r1878938, r1878936, the changes to
  modules/http2/h2_request.c and CHANGES of r1878926 and r1878708 as a result of
  https://lists.apache.org/thread.html/red499ac4750b88e5943c25abb86434c59dfff4d4f386ffc53742755d%40%3Cdev.httpd.apache.org%3E
  and
  https://lists.apache.org/thread.html/ra79eee019e2357703b0ea81153458a29817b58ce92e3605949eee1fe%40%3Cdev.httpd.apache.org%3E

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/http2/h2_request.c
    httpd/httpd/trunk/server/protocol.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1878985&r1=1878984&r2=1878985&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Fri Jun 19 11:45:16 2020
@@ -1,16 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.1
 
-  *) mod_http2: workaround to facilitate use of common internal protocol/method/uri
-     checks. The module now handles master/secondary connections and has marked
-     methods according to use.
-
   *) mod_ldap: Avoid performance overhead of APR-util rebind cache for
      OpenLDAP 2.2+.  PR 64414.  [Joe Orton]
 
-  *) 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.

Modified: httpd/httpd/trunk/modules/http2/h2_request.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_request.c?rev=1878985&r1=1878984&r2=1878985&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_request.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_request.c Fri Jun 19 11:45:16 2020
@@ -267,7 +267,6 @@ static request_rec *my_ap_create_request
 request_rec *h2_request_create_rec(const h2_request *req, conn_rec *c)
 {
     int access_status;
-    int valid_request_line;
 
 #if AP_MODULE_MAGIC_AT_LEAST(20150222, 13)
     request_rec *r = ap_create_request(c);
@@ -279,11 +278,7 @@ request_rec *h2_request_create_rec(const
     
     /* Time to populate r with the data we have. */
     r->request_time = req->request_time;
-    /*
-     * Use HTTP/1.2 as ap_parse_request_line only deals with
-     * HTTP/1.x requests.
-     */
-    r->the_request = apr_psprintf(r->pool, "%s %s HTTP/1.2", 
+    r->the_request = apr_psprintf(r->pool, "%s %s HTTP/2.0", 
                                   req->method, req->path ? req->path : "");
     r->headers_in = apr_table_clone(r->pool, req->headers);
 
@@ -292,22 +287,15 @@ request_rec *h2_request_create_rec(const
      */
     r->hostname = NULL;
 
-    /* Validate HTTP/1 request line. */
-    valid_request_line = ap_parse_request_line(r);
-    /* Note that this is actually a HTTP/2.0 request */
-    r->protocol = "HTTP/2.0";
-    r->proto_num = HTTP_VERSION(2, 0);
-    r->the_request = apr_psprintf(r->pool, "%s %s HTTP/2.0",
-                                  req->method, req->path ? req->path : "");
-    /* Validate headers and select vhost. */
-    if (!valid_request_line || !ap_check_request_header(r)) {
+    /* Validate HTTP/1 request and select vhost. */
+    if (!ap_parse_request_line(r) || !ap_check_request_header(r)) {
         /* we may have switched to another server still */
         r->per_dir_config = r->server->lookup_defaults;
         access_status = r->status;
         r->status = HTTP_OK;
         goto die;
     }
-
+    
     /* we may have switched to another server */
     r->per_dir_config = r->server->lookup_defaults;
 

Modified: httpd/httpd/trunk/server/protocol.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/protocol.c?rev=1878985&r1=1878984&r2=1878985&view=diff
==============================================================================
--- httpd/httpd/trunk/server/protocol.c (original)
+++ httpd/httpd/trunk/server/protocol.c Fri Jun 19 11:45:16 2020
@@ -748,7 +748,7 @@ AP_DECLARE(int) ap_parse_request_line(re
     enum {
         rrl_none, rrl_badmethod, rrl_badwhitespace, rrl_excesswhitespace,
         rrl_missinguri, rrl_baduri, rrl_badprotocol, rrl_trailingtext,
-        rrl_badmethod09, rrl_reject09, rrl_versionnotsupported
+        rrl_badmethod09, rrl_reject09
     } deferred_error = rrl_none;
     apr_size_t len = 0;
     char *uri, *ll;
@@ -897,11 +897,6 @@ 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
      */
@@ -923,7 +918,6 @@ 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'",
@@ -960,13 +954,7 @@ rrl_done:
                           "HTTP Request Line; Unrecognized protocol '%.*s' "
                           "(perhaps whitespace was injected?)",
                           field_name_len(r->protocol), r->protocol);
-        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;
-        }
+        r->status = HTTP_BAD_REQUEST;
         goto rrl_failed;
     }