]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: compression: Make compression offload a flag
authorOlivier Houchard <ohouchard@backtrace.io>
Mon, 3 Apr 2023 20:22:24 +0000 (22:22 +0200)
committerOlivier Houchard <cognet@ci0.org>
Thu, 6 Apr 2023 22:46:45 +0000 (00:46 +0200)
Turn compression offload into a flag in struct comp, instead of using
an int just for it.

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

index 062f17f767708ab3935f2c61f1187e7929d9af5f..cdbf0d14e381e1bc7dc089644c2bf1a19bafc34f 100644 (file)
 
 #include <haproxy/buf-t.h>
 
+/* Compression flags */
+
+#define COMP_FL_OFFLOAD                0x00000001 /* Compression offload */
 struct comp {
        struct comp_algo *algos;
        struct comp_type *types;
-       unsigned int offload;
+       unsigned int flags;
 };
 
 struct comp_ctx {
index ceda3fd5e4354353fff2a1c48a319ff02f8c26bc..5070096928ea267947c9cb123884b2b5e138c0f9 100644 (file)
@@ -451,8 +451,8 @@ select_compression_request_header(struct comp_state *st, struct stream *s, struc
 
        /* remove all occurrences of the header when "compression offload" is set */
        if (st->comp_algo) {
-               if ((s->be->comp && s->be->comp->offload) ||
-                   (strm_fe(s)->comp && strm_fe(s)->comp->offload)) {
+               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))
@@ -690,7 +690,7 @@ parse_compression_options(char **args, int section, struct proxy *proxy,
                                  args[0], args[1]);
                        ret = 1;
                }
-               comp->offload = 1;
+               comp->flags |= COMP_FL_OFFLOAD;
        }
        else if (strcmp(args[1], "type") == 0) {
                int cur_arg = 2;