From 333f0cf1ad231e1731e0b32b29f36aad6e35c04e Mon Sep 17 00:00:00 2001 From: Rainer Jung Date: Sat, 2 Aug 2014 08:24:35 +0000 Subject: [PATCH] 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. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1615289 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 4 ++++ modules/proxy/mod_proxy_http.c | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/CHANGES b/CHANGES index a20bdd9ea70..c87f5c98198 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ -*- coding: utf-8 -*- Changes with Apache 2.5.0 + *) mod_proxy_http: Proxy responses with error status and + "ProxyErrorOverride On" hang until proxy timeout. + PR53420 [Rainer Jung] + *) mod_proxy_wstunnel: Concurrent websockets messages could be lost or delayed with ProxyWebsocketAsync enabled. [Edward Lu ] diff --git a/modules/proxy/mod_proxy_http.c b/modules/proxy/mod_proxy_http.c index 91d14f5a98a..f8813691f18 100644 --- a/modules/proxy/mod_proxy_http.c +++ b/modules/proxy/mod_proxy_http.c @@ -1637,6 +1637,18 @@ int 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, "Content-Length"))) { + apr_table_set(backend->r->headers_in, "Content-Length", tmp); + } + else if ((tmp = apr_table_get(r->headers_out, "Transfer-Encoding"))) { + apr_table_set(backend->r->headers_in, "Transfer-Encoding", tmp); + } + else if (te) { + apr_table_set(backend->r->headers_in, "Transfer-Encoding", te); + } ap_discard_request_body(backend->r); } proxy_run_detach_backend(r, backend); -- 2.47.3