From: Amaury Denoyelle Date: Tue, 7 Dec 2021 15:19:03 +0000 (+0100) Subject: MINOR: hq-interop: fix tx buffering X-Git-Tag: v2.6-dev1~307 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5ede40be6763d3515164e8d123b7d6aaed27624b;p=thirdparty%2Fhaproxy.git MINOR: hq-interop: fix tx buffering On h09 app layer, if there is not enought size in the tx buffer, the transfer is interrupted and the flag QC_SF_BLK_MROOM is positionned. The transfer is woken up by the mux when new buffer size becomes available. This ensure that no data is silently discarded during transfer. Without this, once the buffer is full the data were removed and thus not send to the client resulting in a truncating payload. --- diff --git a/src/hq_interop.c b/src/hq_interop.c index 075e785b04..dc1e1154e6 100644 --- a/src/hq_interop.c +++ b/src/hq_interop.c @@ -94,6 +94,15 @@ static size_t hq_interop_snd_buf(struct conn_stream *cs, struct buffer *buf, case HTX_BLK_DATA: if (fsize > count) fsize = count; + + if (b_size(&outbuf) < fsize) + fsize = b_size(&outbuf); + + if (!fsize) { + qcs->flags |= QC_SF_BLK_MROOM; + goto end; + } + b_putblk(&outbuf, htx_get_blk_ptr(htx, blk), fsize); total += fsize; count -= fsize; @@ -116,6 +125,7 @@ static size_t hq_interop_snd_buf(struct conn_stream *cs, struct buffer *buf, } } + end: if ((htx->flags & HTX_FL_EOM) && htx_is_empty(htx)) qcs->flags |= QC_SF_FIN_STREAM;