Skip to content

fix: read a refused request's body so the next request on the connection survives - #104

Merged
dmccoystephenson merged 1 commit into
mainfrom
fix/drain-refused-bodies
Nov 22, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
fix/drain-refused-bodies

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

A POST or PUT to a game host (405) or to an unknown host (404) was answered without reading its body. On a kept-alive connection, which Traefik reuses, the unread body was then parsed as the start of the next request, and that request was answered 501.

Found live on forward-one.play.danielstephenson.dev: Forward One beacons a small JSON event to /api/river-log on its own origin, and the guide-voice clip loaded straight after it (/audio/guide/*/forward-4.wav) failed with 501 on most page loads, while the same file fetched alone returned 200.

_dispatch now calls the existing _drain() (read a body up to 1 MiB, otherwise close the connection) before each of those refusals. The API host is unchanged: it already reads or drains its own bodies.

Test: test_a_refused_post_does_not_poison_the_next_request_on_a_kept_alive_connection sends a POST/PUT with a body to a game host and an unknown host, then a GET on the same connection. It failed before the fix (501) and passes after. Full suite: 686 passed.


drafted by Claude on behalf of Daniel Stephenson

🤖 Generated with Claude Code

…ion survives

A POST or PUT to a game host (405) or an unknown host (404) was answered
without reading its body. On a kept-alive proxy connection the body was
then parsed as the start of the next request, which got a 501. Forward
One beacons to its own origin, so the clip it loaded next broke at random.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@dmccoystephenson
dmccoystephenson merged commit c1c5f5f into main Nov 22, 2026
4 checks passed
@dmccoystephenson
dmccoystephenson deleted the fix/drain-refused-bodies branch November 22, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant