Skip to content

fix: let a refused upload read the bird server's 413 - #22

Merged
theycallmeswift merged 2 commits into
mainfrom
fix/birdsbirdbirds-413-linger
Oct 16, 2026
Merged

theycallmeswift merged 2 commits into
mainfrom
fix/birdsbirdbirds-413-linger

Conversation

@theycallmeswift

@theycallmeswift theycallmeswift commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

The bird server now answers an oversized upload with 413 and then reads and discards the rest of the body, instead of dropping the connection right away. A client still sending could get a reset instead of the 413. Past four times the PNG cap, the server still drops the connection, so an endless upload can't hold it open.

Decide

  • Merge this, or close it? In the in-app browser (Chromium), fetch read the 413 from the old server 15 of 15 times at 3x and 32x the cap, and curl did too. The reset shows up with Node's HTTP client, which got it in 13 of 20 tries. Safari is untested. Recommend: merge, because the change is small, covered by tests, and makes the answer reliable for any client, not just Chromium.

Ready gate

Step Evidence
Tests and lint npm run verify: ok for all three packages. npm run lint: 0 issues in 15 files. npm test on macOS: 194 of 194. BirdsBirdBirds on Linux in node:26: 93 of 93. ✅
Red run On Linux in node:26, with the old server, the finish-sending and discard-limit tests fail in 5 of 5 runs; with the change, the upload tests pass 5 of 5. With the drain but no discard limit, the discard-limit test fails. Both new tests stream over a raw socket, since Node's HTTP client stops sending once it has an answer and hid the race on Linux. ✅
Sibling sweep refuseOversizedBody is the only place the server drops a connection; both the Content-Length and streamed paths go through it. ✅
Docs and specs None: the package README doesn't describe the 413, and the function's comment covers the new behavior. ✅
Standalone run Ran server.mjs and posted oversized bodies from the drawing page's origin in the in-app browser: 413 every time at 3x and 32x the cap. No Pi playthrough, since only the upload refusal changed. ✅
Editorial pass Reread against docs/style/; the comment says which clients the drain is for. ✅
Skipped tests None. ✅
Secrets, permissions Not touched. ✅

The server dropped the connection as soon as its 413 was out, so a client
still sending the body could get a reset instead of the answer. It now
reads and discards the rest of the body, and drops the connection only
past a discard limit.
@theycallmeswift
theycallmeswift marked this pull request as ready for review October 16, 2026 14:18
…3-linger

# Conflicts:
#	test/birdsbirdbirds.test.mjs
@theycallmeswift
theycallmeswift merged commit 0ec2d3c into main Oct 16, 2026
1 check passed
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