Accept a chunked upstream body of exactly the maximum size (closes #248) #267

Merged
clawbot merged 2 commits from issue-248-chunked-body-at-limit into next 2026-10-15 07:44:09 +02:00
2 Commits
Author SHA1 Message Date
sneak 3afc70999b Accept a chunked upstream body of exactly the maximum size (closes #248)
check / check (push) Waiting to run
Once MaxResponseSize bytes were read, limitedReader.Read refused the
next read without looking for the end of the body. A body sent with a
Content-Length gets io.EOF with its last bytes, but the end of a
chunked body can come in a later read, so a chunked body of exactly
the limit was refused. Once the limit is used up, Read now reads one
more byte: at the end of the body it returns io.EOF, and with more
data it returns ErrResponseTooLarge, as does every later Read.

Model: opus-5-5
2026-10-15 05:09:16 +00:00
sneak d0ad670628 Test a body of exactly the maximum size, chunked or not
A chunked body of exactly MaxResponseSize bytes is refused with
ErrResponseTooLarge; this test fails until the fix. The upstream sends
the end of the chunked body only after the test has read that many
bytes, so the read that finds the limit used up comes first. A body
sent with a Content-Length, and a body one byte over the limit under
either framing, already behave as intended.

Model: opus-5-5
2026-10-15 05:09:16 +00:00