1
0
mirror of http://git.haproxy.org/git/haproxy.git/ synced 2025-04-08 18:23:15 +00:00

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).
This commit is contained in:
Christopher Faulet 2018-12-18 21:57:24 +01:00
parent beefaee4f5
commit 2dba1a50c3

View File

@ -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);