Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A request with
Cache-Control: max-age=3600currently replaces the stored response's freshness lifetime. A response withmax-age=60that is already 120 seconds old is therefore returned from cache. The same happens when its freshness lifetime comes fromExpires, including explicitly expired 301/308 responses.Limit the existing response lifetime with the request's max-age instead of replacing it. RFC 9111 section 5.2.1.1 defines request max-age as an acceptable age bound and distinguishes permission to receive stale responses through max-stale. A larger request max-age does not make an expired response fresh.
This also means an ETag-only response without a freshness lifetime is revalidated even when the client supplies max-age. Its cache entry and conditional validator remain available. The existing heuristic redirect fallback and the library's existing handling of other request directives are unchanged.
Validation on Windows / Python 3.12:
git diff --check: passed.unparseablespellings (and generated documentation when scanning the working tree). Those unrelated files/lines are unchanged.AI assistance: developed with OpenAI Codex and checked through independent Claude Opus and Codex AI reviews. This does not claim human review.