]> granicus.if.org Git - apache/commitdiff
mod_proxy: Fix a request corruption problem and a buffering problem
authorJeff Trawick <trawick@apache.org>
Thu, 30 Dec 2004 16:31:13 +0000 (16:31 +0000)
committerJeff Trawick <trawick@apache.org>
Thu, 30 Dec 2004 16:31:13 +0000 (16:31 +0000)
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

CHANGES
modules/proxy/proxy_http.c

diff --git a/CHANGES b/CHANGES
index 73aea298d38a694ef7352c3ff5cb44d046289c07..d6f79175e6f8faffc3f0d467cdf6e024cf39c5d5 100644 (file)
--- 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]
index 2fc10c17ae2930eb7de9cd0fcadf32383b5ac047..062dad1026a3d877a2c8ee4e8f8b565f6eba1bdd 100644 (file)
@@ -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,
                                        /* <trailers> */
                                        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) {