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/13 16:53:50 UTC
svn commit: r1853518 - /httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
Author: ylavic
Date: Wed Feb 13 16:53:50 2019
New Revision: 1853518
URL: http://svn.apache.org/viewvc?rev=1853518&view=rev
Log:
mod_proxy_http: follow up to r1853409.
Don't send two final 0-size chunks when the last read brigade is a single 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=1853518&r1=1853517&r2=1853518&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_http.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Wed Feb 13 16:53:50 2019
@@ -336,20 +336,32 @@ static int stream_reqbody_chunked(proxy_
}
apr_brigade_length(input_brigade, 1, &bytes);
- hdr_len = apr_snprintf(chunk_hdr, sizeof(chunk_hdr),
- "%" APR_UINT64_T_HEX_FMT CRLF,
- (apr_uint64_t)bytes);
+ if (bytes) {
+ hdr_len = apr_snprintf(chunk_hdr, sizeof(chunk_hdr),
+ "%" APR_UINT64_T_HEX_FMT CRLF,
+ (apr_uint64_t)bytes);
+ ap_xlate_proto_to_ascii(chunk_hdr, hdr_len);
+ e = apr_bucket_transient_create(chunk_hdr, hdr_len,
+ bucket_alloc);
+ APR_BRIGADE_INSERT_HEAD(input_brigade, e);
- ap_xlate_proto_to_ascii(chunk_hdr, hdr_len);
- e = apr_bucket_transient_create(chunk_hdr, hdr_len,
- bucket_alloc);
- APR_BRIGADE_INSERT_HEAD(input_brigade, e);
-
- /*
- * Append the end-of-chunk CRLF
- */
- e = apr_bucket_immortal_create(CRLF_ASCII, 2, bucket_alloc);
- APR_BRIGADE_INSERT_TAIL(input_brigade, e);
+ /*
+ * Append the end-of-chunk CRLF
+ */
+ 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.
+ */
+ break;
+ }
}
/* If we never sent the header brigade, so go ahead and