]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: flt-comp: remove a no-op http_remove_header() call
authorWilly Tarreau <w@1wt.eu>
Mon, 27 Jul 2026 09:03:15 +0000 (11:03 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 27 Jul 2026 13:30:35 +0000 (15:30 +0200)
In select_compression_request_header(), the "compression offload" block starts
with:

http_remove_header(htx, &ctx);
ctx.blk = NULL;
while (http_find_header(htx, ist("Accept-Encoding"), &ctx, 1))
http_remove_header(htx, &ctx);

The first call can never do anything: st->comp_algo is only set from the
"Accept-Encoding" loop above, whose exit condition is http_find_header()
returning 0, which resets ctx.blk to NULL, and http_remove_header() returns
immediately for a NULL ctx.blk. The loop that follows removes all the
occurrences of the header anyway, so the call is dead code, and it would remove
the wrong header if ctx were ever to carry another context.

Let's drop it. No functional change.

src/flt_http_comp.c

index 92248324805970b9d450ee765f4ed3359c401f57..7f2567feb9853620031a02303f52a7b326f6d6ce 100644 (file)
@@ -608,7 +608,6 @@ select_compression_request_header(struct comp_state *st, struct stream *s, struc
        if (st->comp_algo) {
                if ((s->be->comp && (s->be->comp->flags & COMP_FL_OFFLOAD)) ||
                    (strm_fe(s)->comp && (strm_fe(s)->comp->flags & COMP_FL_OFFLOAD))) {
-                       http_remove_header(htx, &ctx);
                        ctx.blk = NULL;
                        while (http_find_header(htx, ist("Accept-Encoding"), &ctx, 1))
                                http_remove_header(htx, &ctx);