8335b1
--- a/modules/proxy/mod_proxy_http.c	2014/08/31 16:06:36	1621600
8335b1
+++ b/modules/proxy/mod_proxy_http.c	2014/08/31 16:07:45	1621601
8335b1
@@ -1652,6 +1652,18 @@
8335b1
             if (!r->header_only && /* not HEAD request */
8335b1
                 (proxy_status != HTTP_NO_CONTENT) && /* not 204 */
8335b1
                 (proxy_status != HTTP_NOT_MODIFIED)) { /* not 304 */
8335b1
+                const char *tmp;
8335b1
+                /* Add minimal headers needed to allow http_in filter
8335b1
+                 * detecting end of body without waiting for a timeout. */
8335b1
+                if ((tmp = apr_table_get(r->headers_out, "Transfer-Encoding"))) {
8335b1
+                    apr_table_set(backend->r->headers_in, "Transfer-Encoding", tmp);
8335b1
+                }
8335b1
+                else if ((tmp = apr_table_get(r->headers_out, "Content-Length"))) {
8335b1
+                    apr_table_set(backend->r->headers_in, "Content-Length", tmp);
8335b1
+                }
8335b1
+                else if (te) {
8335b1
+                    apr_table_set(backend->r->headers_in, "Transfer-Encoding", te);
8335b1
+                }
8335b1
                 ap_discard_request_body(backend->r);
8335b1
             }
8335b1
             return proxy_status;