From: Christopher Faulet Date: Tue, 27 Oct 2026 10:51:14 +0000 (+0100) Subject: MINOR: flt-decomp: Stop to explicitly loop on the proxy's filter_configs list X-Git-Tag: v3.5-dev10~31 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=28eaedd1c0c9966d9043588b313940accd7b09ff;p=haproxy.git MINOR: flt-decomp: Stop to explicitly loop on the proxy's filter_configs list The "decomp-req" and "decomp-res" filter keyword parsers scanned the filter_configs list of the proxy by hand to detect an already declared decompression filter configuration, matching on the filter id. The parsers now use flt_find_conf(), the supported way to find a filter configuration, which walks the right list depending on the filter mode of the proxy. As a side effect, the message of the "decomp-res" duplicate error now names the right filter. --- diff --git a/src/flt_decomp.c b/src/flt_decomp.c index 645b64ad1..b0409342a 100644 --- a/src/flt_decomp.c +++ b/src/flt_decomp.c @@ -1210,7 +1210,6 @@ static int parse_decomp_req_flt(char **args, int *cur_arg, struct proxy *px, struct flt_conf *fconf, char **err, void *private) { - struct flt_conf *fc; struct decomp *decomp; if (!(px->cap & PR_CAP_FE)) { @@ -1219,11 +1218,9 @@ parse_decomp_req_flt(char **args, int *cur_arg, struct proxy *px, return -1; } - list_for_each_entry(fc, &px->filter_configs, list) { - if (fc->id == decomp_req_flt_id) { - memprintf(err, "%s: Proxy supports only one decomp-req filter\n", px->id); - return -1; - } + if (flt_find_conf(px, decomp_req_flt_id, FLT_SIDE_GLOBAL, NULL, NULL)) { + memprintf(err, "%s: Proxy supports only one decomp-req filter\n", px->id); + return -1; } decomp = proxy_get_decomp(px, 0); @@ -1245,7 +1242,6 @@ static int parse_decomp_res_flt(char **args, int *cur_arg, struct proxy *px, struct flt_conf *fconf, char **err, void *private) { - struct flt_conf *fc; struct decomp *decomp; if (!(px->cap & PR_CAP_BE)) { @@ -1254,11 +1250,9 @@ parse_decomp_res_flt(char **args, int *cur_arg, struct proxy *px, return -1; } - list_for_each_entry(fc, &px->filter_configs, list) { - if (fc->id == decomp_res_flt_id) { - memprintf(err, "%s: Proxy supports only one decomp-res filter\n", px->id); - return -1; - } + if (flt_find_conf(px, decomp_res_flt_id, FLT_SIDE_GLOBAL, NULL, NULL)) { + memprintf(err, "%s: Proxy supports only one decomp-req filter\n", px->id); + return -1; } decomp = proxy_get_decomp(px, 0);