mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
MINOR: htx: Be sure to xfer all headers in one time in htx_xfer_blks()
In the function htx_xfer_blks(), we take care to transfer all headers in one time. When the current block is a start-line, we check if there is enough space to transfer all headers too. If not, and if the destination is empty, a parsing error is reported on the source. The H2 multiplexer is the only one to use this function. When a parsing error is reported during the transfer, the flag CS_FL_EOI is also set on the conn_stream.
This commit is contained in:
parent
a39d8ad086
commit
a61e97bcae
13
src/htx.c
13
src/htx.c
@ -502,6 +502,19 @@ struct htx_ret htx_xfer_blks(struct htx *dst, struct htx *src, uint32_t count,
|
||||
if (type == HTX_BLK_UNUSED)
|
||||
goto next;
|
||||
|
||||
/* Be sure to have enough space to xfer all headers in one
|
||||
* time. If not while <dst> is empty, we report a parsing error
|
||||
* on <src>.
|
||||
*/
|
||||
if (mark >= HTX_BLK_EOH && (type == HTX_BLK_REQ_SL || type == HTX_BLK_RES_SL)) {
|
||||
struct htx_sl *sl = htx_get_blk_ptr(src, blk);
|
||||
|
||||
if (sl->hdrs_bytes != -1 && sl->hdrs_bytes > count) {
|
||||
if (htx_is_empty(dst))
|
||||
src->flags |= HTX_FL_PARSING_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sz = htx_get_blksz(blk);
|
||||
info = blk->info;
|
||||
|
@ -5406,8 +5406,11 @@ static size_t h2_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t coun
|
||||
|
||||
htx_xfer_blks(buf_htx, h2s_htx, count, HTX_BLK_EOM);
|
||||
|
||||
if (h2s_htx->flags & HTX_FL_PARSING_ERROR)
|
||||
if (h2s_htx->flags & HTX_FL_PARSING_ERROR) {
|
||||
buf_htx->flags |= HTX_FL_PARSING_ERROR;
|
||||
if (htx_is_empty(buf_htx))
|
||||
cs->flags |= CS_FL_EOI;
|
||||
}
|
||||
|
||||
buf_htx->extra = (h2s_htx->extra ? (h2s_htx->data + h2s_htx->extra) : 0);
|
||||
htx_to_buf(buf_htx, buf);
|
||||
|
Loading…
Reference in New Issue
Block a user