mirror of
https://github.com/Monkopedia/rouse-context.git
synced 2026-11-22 21:29:43 +00:00
Review on #763 found the cap half of that fix pinned six ways and the timeout half implemented but untested -- the "fix the half that is easier to test" shape. #763 merged before this landed, so it follows here. A cap without a timeout still admits a slowloris: a client that declares a body comfortably UNDER the cap and then stops sending holds the request coroutine open indefinitely, and the cap cannot catch it because by construction the body is small. Adds a raw-socket test that declares `Content-Length: 200` (under the cap, so the cheap pre-check cannot fire), sends 20 bytes and goes silent. The only thing that can end that request is the 5s read timeout. It asserts both that the server answered and that the answer took at least three quarters of the timeout -- the elapsed time is what separates "the timeout fired" from "the body parsed instantly and the status means something unrelated". Paired with a control sending the same declared body in full, which must be answered in well under the timeout. Without it, a server that simply waited 5s before answering everything would pass. Pinned by mutation rather than asserted: raising TOKEN_BODY_TIMEOUT_MS from 5s to 600s fails the stall test with `java.net.SocketTimeoutException: Read timed out` -- the server hanging, which is the slowloris the timeout exists to prevent. Tests only; no production change. Claude-Session: https://claude.ai/code/session_01YYSPuh9bZEJkrzvnEpY1QK Co-authored-by: monkopedia-coder <monkopedia-coder@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| src | ||
| build.gradle.kts | ||