From: Stefan Eissing Date: Thu, 27 May 2021 13:17:33 +0000 (+0000) Subject: * mod_http2: using the ap_parse_request_line() unconditionally, now that it is avail... X-Git-Tag: 2.5.0-alpha2-ci-test-only~932 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a63c5ae6238a01ac698e1a0b2da8523bde2a8777;p=thirdparty%2Fapache%2Fhttpd.git * mod_http2: using the ap_parse_request_line() unconditionally, now that it is available in 2.4.x git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1890247 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http2/h2_request.c b/modules/http2/h2_request.c index 45df9b153ec..5adf84151e9 100644 --- a/modules/http2/h2_request.c +++ b/modules/http2/h2_request.c @@ -210,75 +210,12 @@ h2_request *h2_request_clone(apr_pool_t *p, const h2_request *src) return dst; } -#if !AP_MODULE_MAGIC_AT_LEAST(20150222, 13) -static request_rec *my_ap_create_request(conn_rec *c) -{ - apr_pool_t *p; - request_rec *r; - - apr_pool_create(&p, c->pool); - apr_pool_tag(p, "request"); - r = apr_pcalloc(p, sizeof(request_rec)); - AP_READ_REQUEST_ENTRY((intptr_t)r, (uintptr_t)c); - r->pool = p; - r->connection = c; - r->server = c->base_server; - - r->user = NULL; - r->ap_auth_type = NULL; - - r->allowed_methods = ap_make_method_list(p, 2); - - r->headers_in = apr_table_make(r->pool, 5); - r->trailers_in = apr_table_make(r->pool, 5); - r->subprocess_env = apr_table_make(r->pool, 25); - r->headers_out = apr_table_make(r->pool, 12); - r->err_headers_out = apr_table_make(r->pool, 5); - r->trailers_out = apr_table_make(r->pool, 5); - r->notes = apr_table_make(r->pool, 5); - - r->request_config = ap_create_request_config(r->pool); - /* Must be set before we run create request hook */ - - r->proto_output_filters = c->output_filters; - r->output_filters = r->proto_output_filters; - r->proto_input_filters = c->input_filters; - r->input_filters = r->proto_input_filters; - ap_run_create_request(r); - r->per_dir_config = r->server->lookup_defaults; - - r->sent_bodyct = 0; /* bytect isn't for body */ - - r->read_length = 0; - r->read_body = REQUEST_NO_BODY; - - r->status = HTTP_OK; /* Until further notice */ - r->header_only = 0; - r->the_request = NULL; - - /* Begin by presuming any module can make its own path_info assumptions, - * until some module interjects and changes the value. - */ - r->used_path_info = AP_REQ_DEFAULT_PATH_INFO; - - r->useragent_addr = c->client_addr; - r->useragent_ip = c->client_ip; - - return r; -} -#endif - request_rec *h2_request_create_rec(const h2_request *req, conn_rec *c) { - int access_status; + int access_status = HTTP_OK; -#if AP_MODULE_MAGIC_AT_LEAST(20150222, 13) request_rec *r = ap_create_request(c); -#else - request_rec *r = my_ap_create_request(c); -#endif -#if AP_MODULE_MAGIC_AT_LEAST(20200331, 3) ap_run_pre_read_request(r, c); /* Time to populate r with the data we have. */ @@ -307,49 +244,6 @@ request_rec *h2_request_create_rec(const h2_request *req, conn_rec *c) r->status = HTTP_OK; goto die; } -#else - { - const char *s; - - r->headers_in = apr_table_clone(r->pool, req->headers); - ap_run_pre_read_request(r, c); - - /* Time to populate r with the data we have. */ - r->request_time = req->request_time; - r->method = apr_pstrdup(r->pool, req->method); - /* Provide quick information about the request method as soon as known */ - r->method_number = ap_method_number_of(r->method); - if (r->method_number == M_GET && r->method[0] == 'H') { - r->header_only = 1; - } - ap_parse_uri(r, req->path ? req->path : ""); - r->protocol = (char*)"HTTP/2.0"; - r->proto_num = HTTP_VERSION(2, 0); - r->the_request = apr_psprintf(r->pool, "%s %s HTTP/2.0", - r->method, req->path ? req->path : ""); - - /* Start with r->hostname = NULL, ap_check_request_header() will get it - * form Host: header, otherwise we get complains about port numbers. - */ - r->hostname = NULL; - ap_update_vhost_from_headers(r); - - /* we may have switched to another server */ - r->per_dir_config = r->server->lookup_defaults; - - s = apr_table_get(r->headers_in, "Expect"); - if (s && s[0]) { - if (ap_cstr_casecmp(s, "100-continue") == 0) { - r->expecting_100 = 1; - } - else { - r->status = HTTP_EXPECTATION_FAILED; - access_status = r->status; - goto die; - } - } - } -#endif /* we may have switched to another server */ r->per_dir_config = r->server->lookup_defaults;