MINOR: compression: Make compression offload a flag

Turn compression offload into a flag in struct comp, instead of using
an int just for it.
This commit is contained in:
Olivier Houchard 2023-04-03 22:22:24 +02:00 committed by Olivier Houchard
parent 6bb26d41fe
commit 3ce0f01b81
2 changed files with 7 additions and 4 deletions

View File

@ -34,10 +34,13 @@
#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 {

View 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;