On Tue, Oct 29, 2019 at 4:24 PM Rainer Jung <[email protected]> wrote:
>
> Thank you Yann. Let me know when I should test something. It's OK, if it
> is not yet the final fix ;)
The attached patch seems to work for me..
Index: modules/proxy/mod_proxy_http.c
===================================================================
--- modules/proxy/mod_proxy_http.c (revision 1869076)
+++ modules/proxy/mod_proxy_http.c (working copy)
@@ -648,9 +648,12 @@ static int ap_proxy_http_prefetch(proxy_http_req_t
* us an instant C-L election if the body is of some
* reasonable size.
*/
+ apr_brigade_length(input_brigade, 1, &bytes_read);
temp_brigade = apr_brigade_create(p, bucket_alloc);
block = req->prefetch_nonblocking ? APR_NONBLOCK_READ : APR_BLOCK_READ;
- do {
+ while ((bytes_read < MAX_MEM_SPOOL - 80)
+ && (APR_BRIGADE_EMPTY(input_brigade)
+ || !APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(input_brigade)))) {
status = ap_get_brigade(r->input_filters, temp_brigade,
AP_MODE_READBYTES, block,
MAX_MEM_SPOOL - bytes_read);
@@ -710,9 +713,7 @@ static int ap_proxy_http_prefetch(proxy_http_req_t
* surrender once we hit 80 bytes less than MAX_MEM_SPOOL
* (an arbitrary value.)
*/
- } while ((bytes_read < MAX_MEM_SPOOL - 80)
- && !APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(input_brigade))
- && !req->prefetch_nonblocking);
+ }
/* Use chunked request body encoding or send a content-length body?
*
@@ -2090,8 +2091,12 @@ static int proxy_http_handler(request_rec *r, prox
* to reduce to the minimum the unavoidable local is_socket_connected() vs
* remote keepalive race condition.
*/
- req->input_brigade = apr_brigade_create(p, req->bucket_alloc);
req->header_brigade = apr_brigade_create(p, req->bucket_alloc);
+ apr_pool_userdata_get((void **)&req->input_brigade, "proxy-req-input", p);
+ if (req->input_brigade == NULL) {
+ req->input_brigade = apr_brigade_create(p, req->bucket_alloc);
+ apr_pool_userdata_setn(req->input_brigade, "proxy-req-input", NULL, p);
+ }
if ((status = ap_proxy_http_prefetch(req, uri, locurl)) != OK)
goto cleanup;