Repository navigation
jetty: apply maxRequestSize to chunked request bodies - #4055
Merged
jknack merged 1 commit intoNov 27, 2026
Merged
Conversation
…ject#4053 JettyContext.body() wrapped the stream in LimitedInputStream only when the declared length reached maxRequestSize, so a chunked body (length -1) was read with no limit. Netty and Undertow already reject it with 413.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4055 +/- ##
============================================
+ Coverage 94.21% 94.23% +0.01%
- Complexity 6694 6699 +5
============================================
Files 432 432
Lines 20966 20966
Branches 2109 2109
============================================
+ Hits 19753 19757 +4
+ Misses 761 760 -1
+ Partials 452 449 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JettyContext.body()wrapped the request stream inLimitedInputStreamonly when the declared length was at leastmaxRequestSize. A chunked body reports -1, so it was read with no limit. The wrapper now also applies when the length is unknown.Issue4053sends a chunked body over and under a 16 KB limit on every server. Without the change it fails on Jetty only, with 200 instead of 413. Netty and Undertow already return 413.Tested locally on JDK 24 with the
testsandjooby-jettymodules. Everything passes except 15 tests inIssue3508,Issue3508ProblemDetailsandIssue3936, which fail the same way onmainbecause the machine locale is pt_PT and the validator messages come out in Portuguese. With-Duser.language=en -Duser.country=USthey pass too.Fixes #4053