mirror of
https://github.com/storytold/soundcraft.git
synced 2026-10-29 13:06:49 -06:00
Request lines were read with BufRead::lines, which buffers a whole line before anything looks at its length, and every accepted connection got its own thread with no limit. - Read each line with a bounded read: a line longer than MAX_LINE (256 MiB) is refused with an error reply and the connection closed, without buffering the rest of it. - Serve at most MAX_CONNECTIONS (16) connections at once; further ones get an error line and are closed. A slot is released when its connection ends, including when its thread can't start or panics. Request handling is otherwise unchanged. Adds tests for the line limit, CRLF and final-line handling, an end-to-end request over loopback, and the connection cap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>