From: Tim Duesterhus Date: Tue, 1 Sep 2020 16:32:35 +0000 (+0200) Subject: CLEANUP: compression: Make use of http_get_etag_type() X-Git-Tag: v2.3-dev8~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6414cd1fc0bc6ff77b745f8db1232b1f623b6475;p=thirdparty%2Fhaproxy.git CLEANUP: compression: Make use of http_get_etag_type() This commit makes the compressor use http_get_etag_type to validate the ETag instead of using an ad-hoc condition. --- diff --git a/src/flt_http_comp.c b/src/flt_http_comp.c index 87f359d03a..0360d94be2 100644 --- a/src/flt_http_comp.c +++ b/src/flt_http_comp.c @@ -508,11 +508,8 @@ select_compression_response_header(struct comp_state *st, struct stream *s, stru /* no compression when ETag is malformed */ ctx.blk = NULL; if (http_find_header(htx, ist("ETag"), &ctx, 1)) { - if (!(((ctx.value.len >= 4 && memcmp(ctx.value.ptr, "W/\"", 3) == 0) || /* Either a weak ETag */ - (ctx.value.len >= 2 && ctx.value.ptr[0] == '"')) && /* or strong ETag */ - ctx.value.ptr[ctx.value.len - 1] == '"')) { + if (http_get_etag_type(ctx.value) == ETAG_INVALID) goto fail; - } } /* no compression when multiple ETags are present * Note: Do not reset ctx.blk!