]> git.kaiwu.me - haproxy.git/commit
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)
commit975961d5ca26df931dcc2816b7e5ec56abd655ad
treeb8a31a71f3f75c2862921769a85c2f4c0ca40e73
parentd159dc6ff2d9594e9ea5201164435df71fe63128
CLEANUP: flt-comp: remove a no-op http_remove_header() call

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