From: Olivier Houchard Date: Mon, 3 Apr 2023 20:22:24 +0000 (+0200) Subject: MINOR: compression: Make compression offload a flag X-Git-Tag: v2.8-dev7~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3ce0f01b81e32501e9a03e9c3254d1931ba8488b;p=thirdparty%2Fhaproxy.git MINOR: compression: Make compression offload a flag Turn compression offload into a flag in struct comp, instead of using an int just for it. --- diff --git a/include/haproxy/compression-t.h b/include/haproxy/compression-t.h index 062f17f767..cdbf0d14e3 100644 --- a/include/haproxy/compression-t.h +++ b/include/haproxy/compression-t.h @@ -34,10 +34,13 @@ #include +/* 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 { diff --git a/src/flt_http_comp.c b/src/flt_http_comp.c index ceda3fd5e4..5070096928 100644 --- a/src/flt_http_comp.c +++ b/src/flt_http_comp.c @@ -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;