You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2019/02/14 08:22:49 UTC
svn commit: r1853561 - /httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
Author: ylavic
Date: Thu Feb 14 08:22:49 2019
New Revision: 1853561
URL: http://svn.apache.org/viewvc?rev=1853561&view=rev
Log:
mod_proxy_http: follow up to r1853409: don't play with meta-buckets.
It's better/simpler to handle the final 0-size chunk within the loop (on EOS).
Modified:
httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_http.c?rev=1853561&r1=1853560&r2=1853561&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_http.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Thu Feb 14 08:22:49 2019
@@ -337,6 +337,9 @@ static int stream_reqbody_chunked(proxy_
apr_brigade_length(input_brigade, 1, &bytes);
if (bytes) {
+ /*
+ * Prepend the size of the chunk
+ */
hdr_len = apr_snprintf(chunk_hdr, sizeof(chunk_hdr),
"%" APR_UINT64_T_HEX_FMT CRLF,
(apr_uint64_t)bytes);
@@ -351,16 +354,16 @@ static int stream_reqbody_chunked(proxy_
e = apr_bucket_immortal_create(CRLF_ASCII, 2, bucket_alloc);
APR_BRIGADE_INSERT_TAIL(input_brigade, e);
}
- else if (APR_BRIGADE_EMPTY(header_brigade)) {
- if (!seen_eos) {
- /* Metadata only (shouldn't happen), read more */
- apr_brigade_cleanup(input_brigade);
- continue;
- }
- /* At EOS, we are done since the trailing 0-size is handled
- * outside this loop.
+
+ if (seen_eos) {
+ /*
+ * Append the tailing 0-size chunk
*/
- break;
+ e = apr_bucket_immortal_create(ZERO_ASCII CRLF_ASCII
+ /* <trailers> */
+ CRLF_ASCII,
+ 5, bucket_alloc);
+ APR_BRIGADE_INSERT_TAIL(input_brigade, e);
}
}
@@ -369,22 +372,14 @@ static int stream_reqbody_chunked(proxy_
*/
APR_BRIGADE_PREPEND(input_brigade, header_brigade);
- /* No flush here since it's done either on the next loop depending
- * on stream_reqbody_read(), or after the loop with the EOS chunk.
- */
+ /* Flush here on EOS because we won't stream_reqbody_read() again */
rv = ap_proxy_pass_brigade(bucket_alloc, r, p_conn, req->origin,
- input_brigade, 0);
+ input_brigade, seen_eos);
if (rv != OK) {
return rv;
}
} while (!seen_eos);
- e = apr_bucket_immortal_create(ZERO_ASCII CRLF_ASCII
- /* <trailers> */
- CRLF_ASCII,
- 5, bucket_alloc);
- APR_BRIGADE_INSERT_TAIL(input_brigade, e);
-
if (apr_table_get(r->subprocess_env, "proxy-sendextracrlf")) {
e = apr_bucket_immortal_create(CRLF_ASCII, 2, bucket_alloc);
APR_BRIGADE_INSERT_TAIL(input_brigade, e);