From: Jim Jagielski Date: Sun, 31 Aug 2014 16:07:45 +0000 (+0000) Subject: Merge r1615289, r1620324 from trunk: X-Git-Tag: 2.4.11~313 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6d0a719a5dd681349f078b25b6235998e8f0f1e2;p=apache Merge r1615289, r1620324 from trunk: PR53420: Proxy responses with error status and "ProxyErrorOverride On" hang until proxy timeout. Regression from 2.2. It was introduced by r912063 in order to fix PR41646. Switch preference for headers, Transfer-Encoding first, Content-Length second. Addition to r1615289. Submitted by: rjung Reviewed/backported by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1621601 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 7154ea4e42..b2b4c87872 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,10 @@ Changes with Apache 2.4.11 + *) mod_proxy_http: Proxy responses with error status and + "ProxyErrorOverride On" hang until proxy timeout. + PR53420 [Rainer Jung] + *) SECURITY: CVE-2013-5704 (cve.mitre.org) core: HTTP trailers could be used to replace HTTP headers late during request processing, potentially undoing or diff --git a/STATUS b/STATUS index 2f06038ba6..7ab2850b15 100644 --- a/STATUS +++ b/STATUS @@ -101,14 +101,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * mod_proxy_http: Proxy responses with error status and "ProxyErrorOverride On" - hang until proxy timeout. PR53420 - Regression from 2.2. It was introduced by r912063 in order to fix PR41646. - trunk patch: http://svn.apache.org/r1615289 - http://svn.apache.org/r1620324 - 2.4.x patch: trunk works (modulo CHANGES) - +1: rjung, ylavic, covener - * mod_proxy_fcgi: Fix faulty logging of large amounts of stderr from the application. PR 56858. trunk patch: http://svn.apache.org/r1618401 diff --git a/modules/proxy/mod_proxy_http.c b/modules/proxy/mod_proxy_http.c index 1a4d59372f..b8f06c111e 100644 --- a/modules/proxy/mod_proxy_http.c +++ b/modules/proxy/mod_proxy_http.c @@ -1652,6 +1652,18 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r, if (!r->header_only && /* not HEAD request */ (proxy_status != HTTP_NO_CONTENT) && /* not 204 */ (proxy_status != HTTP_NOT_MODIFIED)) { /* not 304 */ + const char *tmp; + /* Add minimal headers needed to allow http_in filter + * detecting end of body without waiting for a timeout. */ + if ((tmp = apr_table_get(r->headers_out, "Transfer-Encoding"))) { + apr_table_set(backend->r->headers_in, "Transfer-Encoding", tmp); + } + else if ((tmp = apr_table_get(r->headers_out, "Content-Length"))) { + apr_table_set(backend->r->headers_in, "Content-Length", tmp); + } + else if (te) { + apr_table_set(backend->r->headers_in, "Transfer-Encoding", te); + } ap_discard_request_body(backend->r); } return proxy_status;