From: William A. Rowe Jr Date: Mon, 8 Aug 2005 00:57:52 +0000 (+0000) Subject: An impossible-to-hit edge case today; we described the request X-Git-Tag: 2.1.7~5^2~41 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d6bbff7719c73ebbaeaa82b6b1c303be7679d03e;p=apache An impossible-to-hit edge case today; we described the request as chunked - and if chunked always send the body termination "0" chunk header. Roy's requested change that we always send a body we could read in full as a C-L request ensures this code wasn't triggered; some change in the future could again reveal this edge case. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@230718 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/mod_proxy_http.c b/modules/proxy/mod_proxy_http.c index 939d908527..ac4e01c00e 100644 --- a/modules/proxy/mod_proxy_http.c +++ b/modules/proxy/mod_proxy_http.c @@ -254,6 +254,7 @@ static apr_status_t stream_reqbody_chunked(apr_pool_t *p, bb = input_brigade; } + /* The request is flushed below this loop with chunk EOS header */ status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, 0); if (status != APR_SUCCESS) { return status; @@ -285,14 +286,16 @@ static apr_status_t stream_reqbody_chunked(apr_pool_t *p, AP_DEBUG_ASSERT(APR_BUCKET_IS_EOS(e)); apr_bucket_delete(e); } - e = apr_bucket_immortal_create(ASCII_ZERO ASCII_CRLF - /* */ - ASCII_CRLF, - 5, bucket_alloc); - APR_BRIGADE_INSERT_TAIL(input_brigade, e); bb = input_brigade; } - + + e = apr_bucket_immortal_create(ASCII_ZERO ASCII_CRLF + /* */ + ASCII_CRLF, + 5, bucket_alloc); + APR_BRIGADE_INSERT_TAIL(bb, e); + + /* Now we have headers-only, or the chunk EOS mark; flush it */ status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, 1); return status; } @@ -365,7 +368,8 @@ static apr_status_t stream_reqbody_cl(apr_pool_t *p, bb = input_brigade; } - status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, 0); + /* Once we hit EOS, we are ready to flush. */ + status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, seen_eos); if (status != APR_SUCCESS) { return status; } @@ -392,16 +396,12 @@ static apr_status_t stream_reqbody_cl(apr_pool_t *p, if (header_brigade) { /* we never sent the header brigade since there was no request - * body; send it now + * body; send it now with the flush flag */ terminate_headers(bucket_alloc, header_brigade); bb = header_brigade; + status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, 1); } - else { - /* need to flush any pending data */ - bb = input_brigade; /* empty now; pass_brigade() will add flush */ - } - status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, 1); return status; } @@ -531,6 +531,7 @@ static apr_status_t spool_reqbody_cl(apr_pool_t *p, } APR_BRIGADE_INSERT_TAIL(header_brigade, e); } + /* This is all a single brigade, pass with flush flagged */ status = pass_brigade(bucket_alloc, r, p_conn, origin, header_brigade, 1); return status; }