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.
This commit is contained in:
Amaury Denoyelle 2021-12-07 16:19:03 +01:00
parent 73dcc6ee62
commit 5ede40be67

View File

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