]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: compression: properly disable request when setting response
authorWilly Tarreau <w@1wt.eu>
Thu, 23 Apr 2026 09:00:11 +0000 (11:00 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 23 Apr 2026 09:55:45 +0000 (11:55 +0200)
In 2.8, commit ead43fe4f2 ("MEDIUM: compression: Make it so we can
compress requests as well.") added the ability to independently enable
compression on request and/or response. However there's a bug in the
"compression direction response" case, which preserves only the request
flag and adds the response direction instead of clearing the request
flag, so this directive would clear offload and make it impossible to
disable request if it was already previously enabled.

This can be backported to stable releases as far as 2.8.

src/flt_http_comp.c

index 50a389c5140142928b2c43a9e0691556648b9eae..bd5117097b706aa2f06e5355521343893fe3fe42 100644 (file)
@@ -997,7 +997,7 @@ parse_compression_options(char **args, int section, struct proxy *proxy,
                        comp->flags &= ~COMP_FL_DIR_RES;
                        comp->flags |= COMP_FL_DIR_REQ;
                } else if (strcmp(args[2], "response") == 0) {
-                       comp->flags &= COMP_FL_DIR_REQ;
+                       comp->flags &= ~COMP_FL_DIR_REQ;
                        comp->flags |= COMP_FL_DIR_RES;
                } else if (strcmp(args[2], "both") == 0)
                        comp->flags |= COMP_FL_DIR_REQ | COMP_FL_DIR_RES;