mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 23:27:04 +02:00
MEDIUM: htx: prevent <mark> to copy incomplete headers in htx_xfer_blks()
Prevent a partial copy of trailers or headers when using the <mark> parameter. When using htx_xfer_blks(), transfering partial headers or trailers are prevented when restricted by the <count> parameter. However using the <mark> parameter will still allow to do it. This patch changes the behavior by checking the <mark> type only after checking the headers/trailers type, so we can still rollback on partial transfer. No impact on the current code, which does not try to do that yet.
This commit is contained in:
parent
4ad2accfee
commit
0a28b1ea0c
12
src/htx.c
12
src/htx.c
@ -730,12 +730,6 @@ struct htx_ret htx_xfer_blks(struct htx *dst, struct htx *src, uint32_t count,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == mark) {
|
|
||||||
blk = htx_get_next_blk(src, blk);
|
|
||||||
srcref = dstref = NULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Save <blk> to <srcref> and <dstblk> to <dstref> when we start
|
/* Save <blk> to <srcref> and <dstblk> to <dstref> when we start
|
||||||
* to xfer headers or trailers. When EOH/EOT block is reached,
|
* to xfer headers or trailers. When EOH/EOT block is reached,
|
||||||
* both are reset. It is mandatory to be able to rollback a
|
* both are reset. It is mandatory to be able to rollback a
|
||||||
@ -748,6 +742,12 @@ struct htx_ret htx_xfer_blks(struct htx *dst, struct htx *src, uint32_t count,
|
|||||||
}
|
}
|
||||||
else if (type == HTX_BLK_EOH || type == HTX_BLK_EOT)
|
else if (type == HTX_BLK_EOH || type == HTX_BLK_EOT)
|
||||||
srcref = dstref = NULL;
|
srcref = dstref = NULL;
|
||||||
|
|
||||||
|
/* <mark> allows a copy of the block which matched, then stop */
|
||||||
|
if (type == mark) {
|
||||||
|
blk = htx_get_next_blk(src, blk);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(dstref)) {
|
if (unlikely(dstref)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user