]> git.kaiwu.me - haproxy.git/commitdiff
CLEANUP: flt_http_comp: remove duplicate rate limit and CPU usage checks
authorWilly Tarreau <w@1wt.eu>
Mon, 11 May 2026 13:31:16 +0000 (15:31 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 11 May 2026 14:04:19 +0000 (16:04 +0200)
In comp_prepare_compress_request(), the compression rate limit and CPU
usage checks were duplicated. The first set runs before selecting the
algorithm, and the second set runs after. That's definitely a copy-paste
issue or a patch being applied twice. Let's just drop one.

include/haproxy/compression-t.h
src/flt_http_comp.c

index 12bf12ce5e86cbdd643cd9cad87ec0bd5e30b31b..fac475eeef441417869b9bb37596a39a61e96718 100644 (file)
@@ -60,7 +60,7 @@ struct comp_ctx {
        struct slz_stream strm;
        const void *direct_ptr; /* NULL or pointer to beginning of data */
        int direct_len;         /* length of direct_ptr if not NULL */
-       struct buffer queued;   /* if not NULL, data already queued */
+       struct buffer queued;   /* if not null, data already queued */
 #elif defined(USE_ZLIB)
        z_stream strm; /* zlib stream */
        void *zlib_deflate_state;
index 9e640f47785430fc002d91fc21f644068d8a8197..a35e92a1d87c252a88016be6c9f175ce2fef7c09 100644 (file)
@@ -172,16 +172,6 @@ comp_prepare_compress_request(struct comp_state *st, struct stream *s, struct ht
        else
                goto fail; /* no algo selected: nothing to do */
 
-
-       /* limit compression rate */
-       if (global.comp_rate_lim > 0)
-               if (read_freq_ctr(&global.comp_bps_in) > global.comp_rate_lim)
-                       goto fail;
-
-       /* limit cpu usage */
-       if (th_ctx->idle_pct < compress_min_idle)
-               goto fail;
-
        /* initialize compression */
        if (st->comp_algo->init(&st->comp_ctx, global.tune.comp_maxlevel) < 0)
                goto fail;