mirror of
https://github.com/caddyserver/caddy.git
synced 2026-11-14 04:33:26 +00:00
* timeouts: take precedence over server-wide and enclosing idle timeouts The timeouts handler wrapped the request body and response writer again, on top of the server's own idle timeout wrappers. The wrapper closest to the connection sets the deadline last, so the server-wide read_body_idle and write_idle (on by default since 2.11.6) silently overrode the route's settings. The same happened between nested timeouts handlers, where the outer, less specific one won. The server now makes its idle timeout wrappers available through the request context, and the timeouts handler overrides their settings while it runs, restoring them when it returns. It only wraps when there's nothing to override, and then registers its own wrappers so that nested handlers override those. The server-wide read_timeout and write_timeout still cap the whole transfer. A handler that doesn't set max_write_chunk keeps the server-wide one. Written with Claude Code (Claude Opus 5.5); the human submitter is responsible for reviewing it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * timeouts: re-arm deadlines on override and suspend outer min-rate window From review: - On HTTP/2, a read or write deadline is a timer that fires even with no read or write in flight. A deadline armed before a timeouts handler started kept the outer timeout and could fail the body (or reset the stream) inside a longer inner scope before the next read reset it. Override and restore now move an armed deadline to the settings that apply. - Time spent under an override counted against the outer MinRate window, so the restored deadline could already have expired. The outer window is now suspended while overridden: its start moves forward by the time spent overridden, and bytes transferred in the meantime don't count towards it. Adds an HTTP/2 read-before-inner-scope regression test and nested minimum-rate coverage. Written with Claude Code (Claude Opus 5.5); the human submitter is responsible for reviewing it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>