]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: compression: Properly get the next block to iterate on payload
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 9 Jun 2021 15:04:37 +0000 (17:04 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 10 Jun 2021 06:57:55 +0000 (08:57 +0200)
When a DATA block is compressed, or when the compression context is finished
on a TLR/EOT block, the next block used to loop on the HTX message must be
refreshed because a defragmentation may have occurred.

This bug was introduced when the EOM block was removed in 2.4. Thus, this
patch must be backported to 2.4.

src/flt_http_comp.c

index ba64877274202cced2bdf4d863a3d2ab59316feb..e7bfa6d5f96d474acb45032bd0ea9fe29b2e6a92 100644 (file)
@@ -206,8 +206,10 @@ comp_http_payload(struct stream *s, struct filter *filter, struct http_msg *msg,
 
                                if (ret == sz && !b_data(&trash))
                                        next = htx_remove_blk(htx, blk);
-                               else
+                               else {
                                        blk = htx_replace_blk_value(htx, blk, v, ist2(b_head(&trash), b_data(&trash)));
+                                       next = htx_get_next_blk(htx, blk);
+                               }
 
                                len -= ret;
                                consumed += ret;
@@ -225,6 +227,7 @@ comp_http_payload(struct stream *s, struct filter *filter, struct http_msg *msg,
                                        blk = htx_get_next_blk(htx, last);
                                        if (!blk)
                                                goto error;
+                                       next = htx_get_next_blk(htx, blk);
                                        to_forward += b_data(&trash);
                                }
                                /* fall through */