mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-09 16:47:18 +02:00
BUG/MEDIUM: compression/filters: Fix loop on HTX blocks compressing the payload
During the payload filtering, the offset is relative to the head of the HTX message and not its first index. This index is the position of the first block to (re)start the HTTP analysis. It must be used during HTTP analysis but not during the payload forwarding. So, from the compression filter point of view, when we loop on the HTX blocks to compress the response payload, we must start from the head of the HTX message. To ease the loop, we use the function htx_find_offset(). This patch must be backported as far as 2.0. It depends on the commit "MINOR: htx: Add a function to return a block at a specific an offset". So this one must be backported first.
This commit is contained in:
parent
497c759558
commit
e6a62bf796
@ -177,19 +177,17 @@ comp_http_payload(struct stream *s, struct filter *filter, struct http_msg *msg,
|
||||
{
|
||||
struct comp_state *st = filter->ctx;
|
||||
struct htx *htx = htxbuf(&msg->chn->buf);
|
||||
struct htx_ret htxret = htx_find_offset(htx, offset);
|
||||
struct htx_blk *blk;
|
||||
int ret, consumed = 0, to_forward = 0;
|
||||
|
||||
for (blk = htx_get_first_blk(htx); blk && len; blk = htx_get_next_blk(htx, blk)) {
|
||||
blk = htxret.blk;
|
||||
offset = htxret.ret;
|
||||
for (; blk && len; blk = htx_get_next_blk(htx, blk)) {
|
||||
enum htx_blk_type type = htx_get_blk_type(blk);
|
||||
uint32_t sz = htx_get_blksz(blk);
|
||||
struct ist v;
|
||||
|
||||
if (offset >= sz) {
|
||||
offset -= sz;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case HTX_BLK_UNUSED:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user