From b7a108897aabcab1fa884f9f34b073e47e0dbf2b Mon Sep 17 00:00:00 2001 From: Alex Rousskov Date: Thu, 14 Nov 2024 00:24:42 +0000 Subject: [PATCH] Treat responses to collapsed requests as fresh (#1927) Squid transactions involving collapsed requests receive their responses as Store cache hits. Cache hits undergo mandatory freshness validation checks and, if those checks detect a stale response, may trigger revalidation (e.g., an If-Modified-Since request to the origin server). This logic results in a still-being-delivered-to-Squid response triggering its own revalidation if that response is deemed stale on arrival by collapsed request (e.g., has a Cache-Control: max-age=0 header field). HTTP RFC 9111 Section 4.7 briefly mentions collapsed requests but is ambiguous with regard to validation of responses to collapsed requests. IETF HTTP Working Group chair believes that specs are unclear, and that these responses should not be treated as cache hits (in primary cases): https://lists.w3.org/Archives/Public/ietf-http-wg/2024JanMar/0095.html This change follows the above advice and prevents arguably excessive freshness checks for responses to collapsed requests. This change is collapsed-forwarding specific: It does not prevent freshness checks for responses that were, at the time of a hit request, either fully cached or still receiving response body bytes. After this change, clientReplyContext can no longer collapse twice, once after initial Store lookup and then again during refresh, because the first collapse now precludes refresh. --- doc/release-notes/release-7.sgml.in | 8 ++++++++ src/StoreClient.h | 4 ++++ src/cf.data.pre | 9 ++++++++- src/client_side_reply.cc | 2 +- src/htcp.cc | 4 ++-- src/icp_v2.cc | 4 ++-- src/refresh.cc | 9 ++++++++- src/store_client.cc | 1 + src/store_digest.cc | 4 ++++ src/urn.cc | 2 ++ test-suite/test-functionality.sh | 1 + 11 files changed, 41 insertions(+), 7 deletions(-) diff --git a/doc/release-notes/release-7.sgml.in b/doc/release-notes/release-7.sgml.in index f33c9992d67..690a8db00e4 100644 --- a/doc/release-notes/release-7.sgml.in +++ b/doc/release-notes/release-7.sgml.in @@ -194,6 +194,14 @@ This section gives an account of those changes in three categories: external_acl_type

Removed %IDENT format code with Ident protocol support. + collapsed_forwarding +

Squid no longer revalidates responses to collapsed requests, treating + all such responses as fresh. This change follows IETF HTTP Working Group + advice (in an HTTP gray area) and prevents arguably excessive freshness + checks for responses to collapsed requests. This change does not prevent + freshness checks for responses that were, at the time of a hit request, + either fully cached or still receiving response body bytes. + Removed directives