From: Jeff Trawick Date: Thu, 30 Dec 2004 16:31:13 +0000 (+0000) Subject: mod_proxy: Fix a request corruption problem and a buffering problem X-Git-Tag: 2.1.3~216 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d2c60589c6bdd69a138a07497f94c4942218ba1e;p=apache mod_proxy: Fix a request corruption problem and a buffering problem which sometimes prevented proxy-sendchunks from working. strlen() couldn't be used since no space had been allocated for trailing NUL, so occasionally the T-E header field contained garbage and a 400 error would be returned by the origin server. The lack of a flush bucket after the final "0\r\n\r\n" was a showstopper for my simple tests (reverse proxy to Apache 1.3 + custom module which read the body). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@123727 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 73aea298d3..d6f79175e6 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,10 @@ Changes with Apache 2.1.3 [Remove entries to the current 2.0 section below, when backported] + *) mod_proxy: Fix a request corruption problem and a buffering problem + which sometimes prevented proxy-sendchunks from working. + [Jeff Trawick] + *) Fix the RPM spec file so that an RPM build now works. An RPM build now requires system installations of APR and APR-util. [Graham Leggett] diff --git a/modules/proxy/proxy_http.c b/modules/proxy/proxy_http.c index 2fc10c17ae..062dad1026 100644 --- a/modules/proxy/proxy_http.c +++ b/modules/proxy/proxy_http.c @@ -467,7 +467,7 @@ apr_status_t ap_proxy_http_request(apr_pool_t *p, request_rec *r, buf = apr_pmemdup(p, te_hdr, sizeof(te_hdr)-1); ap_xlate_proto_to_ascii(buf, sizeof(te_hdr)-1); - e = apr_bucket_pool_create(buf, strlen(buf), p, c->bucket_alloc); + e = apr_bucket_pool_create(buf, sizeof(te_hdr)-1, p, c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(header_brigade, e); } else { @@ -587,6 +587,8 @@ apr_status_t ap_proxy_http_request(apr_pool_t *p, request_rec *r, /* */ ASCII_CRLF, 5, c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(body_brigade, e); + e = apr_bucket_flush_create(c->bucket_alloc); + APR_BRIGADE_INSERT_TAIL(body_brigade, e); } if (!send_chunks) {