A request carrying "Cache-Control: no-store" normally prevents its
response from being stored in the cache. But when the response carries
"Cache-Control: public", it is stored anyway and delivered to other
clients, while RFC 9111#5.2.1.5 says that a cache must not store any part
of the request or of its response, whatever the response says. A client
asking for its response not to be stored, for privacy reasons, may thus
see it delivered to others, though the server marked it as public.
http_check_request_for_cacheability() handles "no-store" by clearing
TX_CACHEABLE and TX_CACHE_COOK, but http_check_response_for_cacheability()
sets them again on "public", since this directive may legitimately make
cacheable a response which is not by default.
The request's directive is now remembered in the TX_CACHE_NOSTORE flag
added by the previous patch, and the response is never considered
cacheable when it is set, whatever its own directives.
The reg-test reg-tests/cache/request_nostore.vtc sends a request with
"no-store" receiving a public response, and checks that it was not
stored. It fails without the fix.
The request's "no-store" was handled since commit
0ad8e0dfe ("MINOR: http:
add a function to check request's cache-control header field") in 1.8,
and the response's "public" could always override it. The fix may be
backported to all supported versions, along with the previous commit
("MINOR: http-ana: add a transaction flag for requests forbidding
storage").