mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-03-18 05:21:08 +01:00
MINOR: htx: Add function to truncate all blocks after a specific block
htx_truncated_blk() function does the same than htx_trunctate(), except data are truncated relatively to a block in the message instead of an offset.
This commit is contained in:
parent
3250ec6e9c
commit
fbdb0a991a
@ -37,6 +37,7 @@ struct htx_blk *htx_add_blk(struct htx *htx, enum htx_blk_type type, uint32_t bl
|
||||
struct htx_blk *htx_remove_blk(struct htx *htx, struct htx_blk *blk);
|
||||
struct htx_ret htx_find_offset(struct htx *htx, uint32_t offset);
|
||||
void htx_truncate(struct htx *htx, uint32_t offset);
|
||||
void htx_truncate_blk(struct htx *htx, struct htx_blk *blk);
|
||||
struct htx_ret htx_drain(struct htx *htx, uint32_t max);
|
||||
|
||||
struct htx_blk *htx_replace_blk_value(struct htx *htx, struct htx_blk *blk,
|
||||
|
||||
12
src/htx.c
12
src/htx.c
@ -469,6 +469,18 @@ void htx_truncate(struct htx *htx, uint32_t offset)
|
||||
blk = htx_remove_blk(htx, blk);
|
||||
}
|
||||
|
||||
/* Removes all blocks after <blk>, excluding it. if <blk> is NULL, all blocks
|
||||
* are removed.
|
||||
*/
|
||||
void htx_truncate_blk(struct htx *htx, struct htx_blk *blk)
|
||||
{
|
||||
if (!blk) {
|
||||
htx_drain(htx, htx->data);
|
||||
return;
|
||||
}
|
||||
for (blk = htx_get_next_blk(htx, blk); blk; blk = htx_remove_blk(htx, blk));
|
||||
}
|
||||
|
||||
/* Drains <count> bytes from the HTX message <htx>. If the last block is a DATA
|
||||
* block, it will be cut if necessary. Others blocks will be removed at once if
|
||||
* <count> is large enough. The function returns an htx_ret with the first block
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user