From: Ruediger Pluem Date: Fri, 19 Jun 2020 11:45:16 +0000 (+0000) Subject: * Revert r1878939, r1878938, r1878936, the changes to X-Git-Tag: 2.5.0-alpha2-ci-test-only~1372 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=943a278020458aa9ee863a722fb042861bc889ba;p=thirdparty%2Fapache%2Fhttpd.git * 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 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1878985 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index d68993a5769..55c86bbd52e 100644 --- a/CHANGES +++ b/CHANGES @@ -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 ) is now used when checking the liveliness of a new or reused h2 connection to the backend. diff --git a/modules/http2/h2_request.c b/modules/http2/h2_request.c index feaf6e93c1f..9d96c300f33 100644 --- a/modules/http2/h2_request.c +++ b/modules/http2/h2_request.c @@ -267,7 +267,6 @@ static request_rec *my_ap_create_request(conn_rec *c) 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 h2_request *req, conn_rec *c) /* 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 h2_request *req, conn_rec *c) */ 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; diff --git a/server/protocol.c b/server/protocol.c index 6eb1786459f..76baabbe291 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -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_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; }