You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2021/08/24 09:31:16 UTC

svn commit: r1892563 - /httpd/httpd/trunk/modules/proxy/mod_proxy_http.c

Author: ylavic
Date: Tue Aug 24 09:31:16 2021
New Revision: 1892563

URL: http://svn.apache.org/viewvc?rev=1892563&view=rev
Log:
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.

Modified:
    httpd/httpd/trunk/modules/proxy/mod_proxy_http.c

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_http.c?rev=1892563&r1=1892562&r2=1892563&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_http.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Tue Aug 24 09:31:16 2021
@@ -1279,9 +1279,14 @@ int ap_proxy_http_process_response(proxy
                                                    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
                 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,