mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 06:11:32 +02:00
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.
This commit is contained in:
parent
5bbdc81cf1
commit
6414cd1fc0
@ -508,11 +508,8 @@ select_compression_response_header(struct comp_state *st, struct stream *s, stru
|
|||||||
/* no compression when ETag is malformed */
|
/* no compression when ETag is malformed */
|
||||||
ctx.blk = NULL;
|
ctx.blk = NULL;
|
||||||
if (http_find_header(htx, ist("ETag"), &ctx, 1)) {
|
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 */
|
if (http_get_etag_type(ctx.value) == ETAG_INVALID)
|
||||||
(ctx.value.len >= 2 && ctx.value.ptr[0] == '"')) && /* or strong ETag */
|
|
||||||
ctx.value.ptr[ctx.value.len - 1] == '"')) {
|
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* no compression when multiple ETags are present
|
/* no compression when multiple ETags are present
|
||||||
* Note: Do not reset ctx.blk!
|
* Note: Do not reset ctx.blk!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user