From f4ff56e064a5249ff62584bc174824d45fddf9f8 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Mon, 12 Jul 2021 14:54:55 -0400 Subject: [PATCH] [mod_deflate] use http_header_str_contains_token --- src/mod_deflate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mod_deflate.c b/src/mod_deflate.c index 907df572..01d239e2 100644 --- a/src/mod_deflate.c +++ b/src/mod_deflate.c @@ -1833,9 +1833,9 @@ REQUEST_FUNC(mod_deflate_handle_response_start) { /* Vary: Accept-Encoding (response might change according to request Accept-Encoding) */ if (NULL != (vb = http_header_response_get(r, HTTP_HEADER_VARY, CONST_STR_LEN("Vary")))) { had_vary = 1; - if (NULL == strstr(vb->ptr, "Accept-Encoding")) { + if (!http_header_str_contains_token(BUF_PTR_LEN(vb), + CONST_STR_LEN("Accept-Encoding"))) buffer_append_string_len(vb, CONST_STR_LEN(",Accept-Encoding")); - } } else { http_header_response_append(r, HTTP_HEADER_VARY, CONST_STR_LEN("Vary"), @@ -1897,7 +1897,8 @@ REQUEST_FUNC(mod_deflate_handle_response_start) { /* clear Content-Length and r->write_queue if HTTP HEAD request * (alternatively, could return original Content-Length with HEAD - * request if ETag not modified and Content-Encoding not added) */ + * request if ETag not modified and Content-Encoding not added) + * (see top of this func where short-circuit is done on HTTP HEAD) */ if (HTTP_METHOD_HEAD == r->http_method) { /* ensure that uncompressed Content-Length is not sent in HEAD response */ http_response_body_clear(r, 0);