Repository navigation
caddyhttp: end request-body deadline ownership with handler - #8107
Conversation
|
"and removed request for dunglas" -- Did I now? 🧐 |
0b75547 to
b19e7ce
Compare
|
Pushed b19e7ce on top of this: Before, it armed a deadline for every request whose body was never read, including bodyless GETs. Only HTTP/1 drains an unread body on the connection after the handler returns, so that's the only case the deadline protects. On HTTP/2,
Otherwise LGTM. I checked that the new regression tests fail against the pre-fix reader (h2 late-read panic; HTTP/1 418 from the cancelled context) and pass with the fix. Unrelated to this PR, but worth a follow-up: when Assistance DisclosureClaude Code (Opus 5.5) did the review, wrote the patch and drafted this comment; I reviewed them. |
HandlerDone armed a final read deadline for every request whose body was never read, including bodyless GETs. Only HTTP/1 drains an unread body on the connection after the handler returns; on HTTP/2 the deadline is a serve-loop message plus a timer per stream which can outlive the stream if processed after it closes. Gate it behind a DrainDeadline field, set for HTTP/1 requests with a non-zero ContentLength. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b19e7ce to
0360a87
Compare
2.11.4 was pinned because 2.11.6 crashed the proxy (#988). Caddy 2.11.7 fixes that crash (caddyserver/caddy#8107), and its official Docker image is now published. Both compose files move to the same 2.11.7 image by digest, and the anchor comment says why. Closes #989 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CwrjDhHx6t7YacvC5CJ21W
…pair python:3.12-slim (polaris_web/Dockerfile) and python:3.12-slim-bookworm (both Dockerfile.prod stages) were re-resolved on 2026-10-23 (anonymous read of Docker Hub's index). Both tags had moved past the grouped update's digests, so they take today's, a0f57064 and 6a0e06f5, each an index that lists linux/amd64 and linux/arm64. The update's digests are in no tracked file now. Dockerfile.caddy now fails the build unless the copied binary's `caddy version` names the release its runtime base's CADDY_VERSION names; an empty CADDY_VERSION fails too. The grouped update first moved the runtime to 2.11.7 while the compile stage still built 2.11.6, and nothing in the build compared the two. The Dependabot ignore's comment now says why each release is skipped: 2.11.7 for caddyserver/caddy#8165 (the edge-limits drill fails its case 2 there; 2.11.4 and 2.11.6 end the body at read_body), and 2.11.6 for caddyserver/caddy#8101 (a crash reading an HTTP/2 request body after its handler returns, fixed in 2.11.7 by caddyserver/caddy#8107). That `versions` matches the suffixed tags (2.11.7-alpine, 2.11.7-builder-alpine) rests on dependabot-core's source, not its documentation, which says only "Bundler version syntax": at d261cc79, docker/lib/dependabot/docker/tag.rb `numeric_version` drops the `-[a-z]+` suffixes, and update_checker.rb `filter_ignored` rejects a tag whose numeric version satisfies an ignore requirement. The pair check above is the guard either way. EVIDENCE: - The RUN line on the 2.11.4 pair, measured on 2026-10-21 on an export whose Dockerfile.caddy differs from this one only in the comment's wording (sealed DOCKER_CONFIG, no push, a throwaway tag): the build exits 0, and the image's CADDY_VERSION and the first field of its `caddy version` are both v2.11.4. With the compile stage on the official 2.11.3 compile image, pinned by its digest (3eae6b35), and the runtime kept, the build fails at the new RUN line (exit 1). The edge-limits drill on the built image exits 0: the slow body is ended after 31.1 s while a GET is answered in 0.1 s, a 2 MiB body gets 413, and trickled headers are ended after 10.0 s. CI's caddy-edge job builds this tree and runs the drill again. Qualifying reason: THREAT-MODEL (docs/RED-TEAM-SCOPE.md l.287, "to substitute a base image": an update that moved the runtime base to another Caddy release than the one compiled passed the build; with the compile stage on 2.11.3 and the runtime on 2.11.4 the build now fails at the new RUN line). The digests and the comment are housekeeping. Signed-off-by: Khaklin Technologies <PolarisID@protonmail.com>
Fixes #8101 and #8103 -- Closes #8106
Summary
Prevent request-body reads from using the response controller after the handler which installed their timeout has returned. The reader now caches terminal body errors so transport drain reads cannot rearm a deadline after EOF. Handler completion revokes controller access while retaining a final idle deadline for any unread-body drain. The new lifecycle applies to server-level idle timeouts and the route-level timeouts handler.
Assistance Disclosure
None.