From: Willy Tarreau Date: Mon, 27 Jul 2026 09:03:15 +0000 (+0200) Subject: CLEANUP: flt-comp: remove a no-op http_remove_header() call X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=975961d5ca26df931dcc2816b7e5ec56abd655ad;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/flt_http_comp.c b/src/flt_http_comp.c index 922483248..7f2567feb 100644 --- a/src/flt_http_comp.c +++ b/src/flt_http_comp.c @@ -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);