Skip to content

Skip LastModified expiry when the Date header cannot be parsed - #483

Closed
jadenfix wants to merge 1 commit into
psf:masterfrom
jadenfix:skip-invalid-date-heuristics
Closed

jadenfix wants to merge 1 commit into
psf:masterfrom
jadenfix:skip-invalid-date-heuristics

Conversation

@jadenfix

Copy link
Copy Markdown

LastModified() asserts that the response's Date header can be parsed. An empty or unparseable Date therefore makes an otherwise readable HTTP request raise AssertionError before its body is returned. Skip heuristic expiry in that case, matching the existing handling of an invalid Last-Modified header and the controller's invalid-Date recovery added in #449.

Adds regressions for empty and unparseable Date values, including unchanged response headers. Both fail on the base. The full suite passes on Python 3.10.20 and 3.13.14 (117 tests each), make lint passes, and the strict Sphinx build passes. A separately installed wheel passed actual localhost HTTP requests: invalid/empty Date responses return their bodies without heuristic expiry or caching, while a valid Date still produces a cache hit on the second request.

Changed-file formatting and spelling checks pass. Optional whole-tree checks retain exactly the baseline findings: Ruff formatting in unchanged controller.py/redis_cache.py, and two existing spelling findings in test_cache_control.py. Other interpreters/platforms and upstream CI remain unverified.

AI disclosure: prepared with OpenAI Codex. A separate Codex agent independently reviewed exact commit 90db73a and independently ran the focused regressions and localhost HTTP consumer. This is automated review, not human maintainer review.

@psf psf locked and limited conversation to collaborators Oct 18, 2026
@woodruffw woodruffw closed this Oct 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants