From: Amos Jeffries Date: Sun, 30 Oct 2016 09:45:03 +0000 (+1300) Subject: HTTP/1.1: make Vary:* objects cacheable X-Git-Tag: SQUID_3_5_23~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39ba8d75e0351afb9a7636d9c366b6b41f189fa5;p=thirdparty%2Fsquid.git HTTP/1.1: make Vary:* objects cacheable Under new clauses from RFC 7231 section 7.1.4 and HTTP response containing header Vary:* (wifcard variant) can be cached, but requires revalidation with server before each use. Use the new mandatory revalidation flags to allow storing of any wildcard Vary:* response. Note that responses with headers like Vary:A,B,C,* are equivalent to Vary:*. The cache key string for these objects is normalized. --- diff --git a/src/http.cc b/src/http.cc index 24649aa04d..06bbf0ecf5 100644 --- a/src/http.cc +++ b/src/http.cc @@ -594,7 +594,7 @@ assembleVaryKey(String &vary, SBuf &vstr, const HttpRequest &request) while (strListGetItem(&vary, ',', &item, &ilen, &pos)) { SBuf name(item, ilen); if (name == asterisk) { - vstr.clear(); + vstr = asterisk; break; } name.toLower(); @@ -917,6 +917,12 @@ HttpStateData::haveParsedReplyHeaders() varyFailure = true; } else { entry->mem_obj->vary_headers = vary; + + // RFC 7231 section 7.1.4 + // Vary:* can be cached, but has mandatory revalidation + static const SBuf asterisk("*"); + if (vary == asterisk) + EBIT_SET(entry->flags, ENTRY_REVALIDATE_ALWAYS); } }