From d759f4744cdd29e118cf84589463352ab28be16d Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Mon, 5 Oct 2026 21:51:04 +0200 Subject: [PATCH] MINOR: flt-http-comp: Use compression options as filter config All comp filter configurations left their ->conf pointer NULL: the request and response compression filters resolved the proxy options at runtime, through strm_fe(s)->comp and s->be->comp, so the pointer was never used by the stream callbacks. Now store the proxy's compression configuration (px->comp) in the filter configurations, for the explicit "filter compression", "filter comp-req" and "filter comp-res" declarations as well as for the filters implicitly declared by check_implicit_http_comp_flt(). The compression options become the actual configuration of these filters, like the decompression filters already do with their direction. No stream callback is changed: the runtime resolution through the frontend and backend proxies is preserved, since the options of both proxies are combined to compress a message, with a priority to the backend ones. But the attach callback can now rely on FLT_CONF() to know whether a filter can be useful, and the http-comp filter instances will set the same pointer. The configuration remains owned by the proxy and released with it: the compression filters have no deinit callback freeing ->conf. --- src/flt_http_comp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/flt_http_comp.c b/src/flt_http_comp.c index 1d6ca1a9c..f5c6ca134 100644 --- a/src/flt_http_comp.c +++ b/src/flt_http_comp.c @@ -1045,7 +1045,7 @@ parse_http_comp_flt(char **args, int *cur_arg, struct proxy *px, fconf->id = http_comp_req_flt_id; fconf->name = "comp-req"; - fconf->conf = NULL; + fconf->conf = px->comp; fconf->ops = &comp_req_ops; /* FILTER API prepared a single filter_conf struct as it is meant to @@ -1061,7 +1061,7 @@ parse_http_comp_flt(char **args, int *cur_arg, struct proxy *px, } fconf_res->id = http_comp_res_flt_id; fconf_res->name = "comp-res"; - fconf_res->conf = NULL; + fconf_res->conf = px->comp; fconf_res->ops = &comp_res_ops; /* manually add the fconf_res to the list because filter API doesn't @@ -1097,7 +1097,7 @@ parse_http_comp_req_flt(char **args, int *cur_arg, struct proxy *px, comp->flags |= COMP_FL_DIR_REQ; fconf->id = http_comp_req_flt_id; - fconf->conf = NULL; + fconf->conf = px->comp; fconf->ops = &comp_req_ops; (*cur_arg)++; @@ -1126,7 +1126,7 @@ parse_http_comp_res_flt(char **args, int *cur_arg, struct proxy *px, comp->flags |= COMP_FL_DIR_RES; fconf->id = http_comp_res_flt_id; - fconf->conf = NULL; + fconf->conf = px->comp; fconf->ops = &comp_res_ops; (*cur_arg)++; @@ -1190,12 +1190,12 @@ check_implicit_http_comp_flt(struct proxy *proxy) goto end; } fconf_req->id = http_comp_req_flt_id; - fconf_req->conf = NULL; + fconf_req->conf = proxy->comp; fconf_req->ops = &comp_req_ops; LIST_APPEND(&proxy->filter_configs, &fconf_req->list); fconf_res->id = http_comp_res_flt_id; - fconf_res->conf = NULL; + fconf_res->conf = proxy->comp; fconf_res->ops = &comp_res_ops; LIST_APPEND(&proxy->filter_configs, &fconf_res->list); end: -- 2.47.3