]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_proxy_http: Avoid a double call to apr_table_get().
authorYann Ylavic <ylavic@apache.org>
Tue, 24 Aug 2021 09:31:16 +0000 (09:31 +0000)
committerYann Ylavic <ylavic@apache.org>
Tue, 24 Aug 2021 09:31:16 +0000 (09:31 +0000)
* 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

modules/proxy/mod_proxy_http.c

index 25239010b67eaa78bda7e7e7d6a8e3c1e906c194..49b7ec4900f8be90caea27850f81afe394746838 100644 (file)
@@ -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,