From: Christopher Faulet Date: Tue, 18 Dec 2018 20:57:24 +0000 (+0100) Subject: BUG/MEDIUM: stream: Forward the right amount of data before infinite forwarding X-Git-Tag: v1.9.0~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2dba1a50c366e3820b38a50b4a54c3845dc9530d;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: stream: Forward the right amount of data before infinite forwarding Before setting the infinite forward, we first forward all remaining input data from the channel. Of course for HTX streams, this must be done using the amount of data in the HTX message not in the channel (which appears as full because of the HTX). --- diff --git a/src/stream.c b/src/stream.c index 941f489792..eec2d0a187 100644 --- a/src/stream.c +++ b/src/stream.c @@ -2180,19 +2180,22 @@ redo: channel_auto_read(req); channel_auto_connect(req); channel_auto_close(req); - c_adv(req, ci_data(req)); - if (IS_HTX_STRM(s) && s->txn) { + if (IS_HTX_STRM(s)) { + struct htx *htx = htxbuf(&req->buf); + /* We'll let data flow between the producer (if still connected) - * to the consumer (which might possibly not be connected yet). + * to the consumer. */ + co_set_data(req, htx->data); if (!(req->flags & (CF_SHUTR|CF_SHUTW_NOW))) - channel_htx_forward_forever(req, htxbuf(&req->buf)); + channel_htx_forward_forever(req, htx); } else { /* We'll let data flow between the producer (if still connected) * to the consumer (which might possibly not be connected yet). */ + c_adv(req, ci_data(req)); if (!(req->flags & (CF_SHUTR|CF_SHUTW_NOW))) channel_forward_forever(req); @@ -2350,20 +2353,22 @@ redo: */ channel_auto_read(res); channel_auto_close(res); - c_adv(res, ci_data(res)); + if (IS_HTX_STRM(s)) { + struct htx *htx = htxbuf(&res->buf); - if (IS_HTX_STRM(s) && s->txn) { /* We'll let data flow between the producer (if still connected) * to the consumer. */ + co_set_data(res, htx->data); if (!(res->flags & (CF_SHUTR|CF_SHUTW_NOW))) - channel_htx_forward_forever(res, htxbuf(&res->buf)); + channel_htx_forward_forever(res, htx); } else { /* We'll let data flow between the producer (if still connected) * to the consumer. */ + c_adv(res, ci_data(res)); if (!(res->flags & (CF_SHUTR|CF_SHUTW_NOW))) channel_forward_forever(res);