caddy/caddytest
Kévin Dunglas b53025bf19
requestbody: enforce max_size early using Content-Length (#8337)
* requestbody: reject oversized Content-Length before the next handler

When max_size is set and the request declares a Content-Length above it, respond 413 right away instead of letting the next handler start and fail mid-read. Bodies of unknown length are still limited by MaxBytesReader. Both paths return the same error, so handle_errors sees no difference.

* caddytest: send unknown-length bodies in max_size placeholder tests

request_body now answers 413 for a declared Content-Length over max_size before the placeholder reads the body, so these tests no longer covered the read path and the direct respond one failed.

* requestbody: keep the body limited for error routes

Error routes get the same request, so wrap the body before the early 413 to stop them from reading past max_size.

(cherry picked from commit 6cdffe9502)
2026-11-03 18:25:44 -05:00
..
integration requestbody: enforce max_size early using Content-Length (#8337) 2026-11-03 18:25:44 -05:00
a.caddy.localhost.crt caddyhttp: Add default SNI tests (#3146) 2020-03-17 12:39:01 -06:00
a.caddy.localhost.key caddyhttp: Add default SNI tests (#3146) 2020-03-17 12:39:01 -06:00
caddy.ca.cer httpcaddyfile: Add client_auth options to tls directive (#3335) 2020-06-05 12:19:36 -06:00
caddy.localhost.crt caddyhttp: Fix default SNI for default conn policy (#3141) 2020-03-13 11:32:53 -06:00
caddy.localhost.key caddyhttp: Fix default SNI for default conn policy (#3141) 2020-03-13 11:32:53 -06:00
caddytest.go chore: fix lint errors from newer golangci-lint (#7958) 2026-08-25 13:12:10 +10:00
caddytest_test.go core: Check whether @id is unique (#7002) 2026-03-03 15:09:49 -07:00
leafcert.pem caddytls: clientauth: leaf verifier: make trusted leaf certs source pluggable (#6050) 2024-03-05 14:55:37 -07:00