Skip to content

jetty: apply maxRequestSize to chunked request bodies - #4055

Merged
jknack merged 1 commit into
jooby-project:mainfrom
shawzyy457:jetty-chunked-max-request-size
Nov 27, 2026
Merged

jknack merged 1 commit into
jooby-project:mainfrom
shawzyy457:jetty-chunked-max-request-size

Conversation

@shawzyy457

Copy link
Copy Markdown
Contributor

JettyContext.body() wrapped the request stream in LimitedInputStream only when the declared length was at least maxRequestSize. A chunked body reports -1, so it was read with no limit. The wrapper now also applies when the length is unknown.

Issue4053 sends 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 tests and jooby-jetty modules. Everything passes except 15 tests in Issue3508, Issue3508ProblemDetails and Issue3936, which fail the same way on main because the machine locale is pt_PT and the validator messages come out in Portuguese. With -Duser.language=en -Duser.country=US they pass too.

Fixes #4053

…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

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.23%. Comparing base (9c1d0ee) to head (0d596e9).
⚠️ Report is 10 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jknack jknack added this to the 4.6.1 milestone Nov 27, 2026
@jknack
jknack merged commit 119fe4f into jooby-project:main Nov 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

jetty: chunked request bodies skip maxRequestSize since 4.6.0

2 participants