From: Yann Ylavic Date: Tue, 24 Aug 2021 09:31:16 +0000 (+0000) Subject: mod_proxy_http: Avoid a double call to apr_table_get(). X-Git-Tag: 2.5.0-alpha2-ci-test-only~857 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9acfea84831efac669e2cd4cae519e0cae7e947f;p=thirdparty%2Fapache%2Fhttpd.git mod_proxy_http: Avoid a double call to apr_table_get(). * modules/proxy/mod_proxy_http.c (ap_proxy_http_process_response): Save a call to apr_table_get(r->headers_out, "Transfer-Encoding"). No functional change. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1892563 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/mod_proxy_http.c b/modules/proxy/mod_proxy_http.c index 25239010b67..49b7ec4900f 100644 --- a/modules/proxy/mod_proxy_http.c +++ b/modules/proxy/mod_proxy_http.c @@ -1279,9 +1279,14 @@ int ap_proxy_http_process_response(proxy_http_req_t *req) save_table); } + /* + * Save a possible Transfer-Encoding header as we need it later for + * ap_http_filter to know where to end. + */ + te = apr_table_get(r->headers_out, "Transfer-Encoding"); + /* can't have both Content-Length and Transfer-Encoding */ - if (apr_table_get(r->headers_out, "Transfer-Encoding") - && apr_table_get(r->headers_out, "Content-Length")) { + if (te && apr_table_get(r->headers_out, "Content-Length")) { /* * 2616 section 4.4, point 3: "if both Transfer-Encoding * and Content-Length are received, the latter MUST be @@ -1299,12 +1304,6 @@ int ap_proxy_http_process_response(proxy_http_req_t *req) backend->close = 1; } - /* - * Save a possible Transfer-Encoding header as we need it later for - * ap_http_filter to know where to end. - */ - te = apr_table_get(r->headers_out, "Transfer-Encoding"); - upgrade = apr_table_get(r->headers_out, "Upgrade"); if (proxy_status == HTTP_SWITCHING_PROTOCOLS) { if (!upgrade || !req->upgrade || (strcasecmp(req->upgrade,