Commit a4e1af24 authored by Jeff Trawick's avatar Jeff Trawick
Browse files

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
parent 589c77c4
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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]
+3 −1
Original line number Diff line number Diff line
@@ -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) {