GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix UnsupportedOperationException in readTrailingHeaders by furkanvarol · Pull Request #16412 · netty/netty

Conversation

@furkanvarol

@furkanvarol furkanvarol commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

Motivation:

When a chunked HTTP message contains a trailer field with a folded value (obs-fold continuation line starting with SP or HT), readTrailingHeaders threw UnsupportedOperationException. This happened because the folding logic called List.set() on the list returned by trailingHeaders().getAll(), which is an AbstractList implementation that does not override set().

Modifications:

Changed readTrailingHeaders in HttpObjectDecoder to accumulate folded continuation lines into the instance-level value field, mirroring the pattern already used by readHeaders. The previous header is now flushed via trailingHeaders().add() only once its complete value is assembled, eliminating the need to mutate the list returned by getAll(). Forbidden trailer fields (Content-Length, Transfer-Encoding, Trailer) are filtered at flush time, consistent with the previous behaviour.

Added tests to HttpRequestDecoderTest and HttpResponseDecoderTest covering:

  • A single trailer field
  • A folded trailer field with multiple SP and HT continuation lines, followed by a non-folded trailer to verify isolation between fields
  • Forbidden trailer fields interleaved with a valid one, with a forbidden field placed last to exercise the post-loop flush path

Result:

Chunked HTTP messages with folded trailer values are now decoded correctly instead of throwing UnsupportedOperationException.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@normanmaurer
normanmaurer requested review from chrisvest and yawkat March 5, 2026 15:56
@normanmaurer normanmaurer added this to the 4.2.11.Final milestone Mar 5, 2026
@normanmaurer

normanmaurer commented Mar 5, 2026

Copy link
Copy Markdown
Member

Great catch!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer normanmaurer added needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. labels Mar 6, 2026
@furkanvarol

furkanvarol commented Mar 6, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Thanks! Happy to contribute :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer

normanmaurer commented Mar 9, 2026

Copy link
Copy Markdown
Member

@vietj as well... PTAL

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

yawkat
yawkat reviewed Mar 10, 2026
View reviewed changes

@yawkat yawkat left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine in principle, but this is dangerous code to touch… It's a niche feature, it relates to HTTP/1.1 parsing, the patch expands the permitted inputs. That's the perfect mix for a new request smuggling vuln

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

chrisvest
chrisvest reviewed Mar 10, 2026
View reviewed changes
Comment thread codec-http/src/test/java/io/netty/handler/codec/http/HttpRequestDecoderTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread codec-http/src/test/java/io/netty/handler/codec/http/HttpResponseDecoderTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@furkanvarol

furkanvarol commented Mar 11, 2026

Copy link
Copy Markdown
Contributor Author

Hey @yawkat, thanks for reviewing the PR. I agree it is a niche feature and I'm not sure anyone is actively using trailers with obs-folding in practice.

Regarding your comment about expanding permitted inputs — could you clarify what you mean? The goal of this fix is not to widen the accepted input space, but to correctly implement what the original code already intended to support. The previous logic explicitly handled obs-folding in trailers, it just crashed with an UnsupportedOperationException due to calling List.set() on an AbstractList that does not override it. So the permitted inputs are unchanged in intent — the fix just makes the implementation match that intent.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@furkanvarol
Fix UnsupportedOperationException in readTrailingHeaders
32ef7f4
Motivation:

When a chunked HTTP message contains a trailer field with a folded value
(obs-fold continuation line starting with SP or HT), readTrailingHeaders
threw UnsupportedOperationException. This happened because the folding
logic called List.set() on the list returned by trailingHeaders().getAll(),
which is an AbstractList implementation that does not override set().

Modifications:

Changed readTrailingHeaders in HttpObjectDecoder to accumulate folded
continuation lines into the instance-level `value` field, mirroring the
pattern already used by readHeaders. The previous header is now flushed
via trailingHeaders().add() only once its complete value is assembled,
eliminating the need to mutate the list returned by getAll(). Forbidden
trailer fields (Content-Length, Transfer-Encoding, Trailer) are filtered
at flush time, consistent with the previous behaviour.

Added tests to HttpRequestDecoderTest and HttpResponseDecoderTest covering:
- A single trailer field
- A folded trailer field with multiple SP and HT continuation lines,
  followed by a non-folded trailer to verify isolation between fields
- Forbidden trailer fields interleaved with a valid one, with a forbidden
  field placed last to exercise the post-loop flush path

Result:

Chunked HTTP messages with folded trailer values are now decoded correctly
instead of throwing UnsupportedOperationException.
@furkanvarol
furkanvarol force-pushed the 4.2 branch from 50bb4b6 to 32ef7f4 Compare March 11, 2026 06:18
github-advanced-security[bot]
github-advanced-security AI found potential problems Mar 11, 2026
View reviewed changes
Comment thread codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java Dismissed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java Dismissed

Uh oh!

There was an error while loading. Please reload this page.

@yawkat

yawkat commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

I understand the previous code was buggy, but that behavior may have protected us against more exotic request smuggling. Fixing it essentially does broaden the scope of accepted inputs.

Not saying the code should be left as-is, but it is dangerous to modify

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer

normanmaurer commented Mar 11, 2026

Copy link
Copy Markdown
Member

Hey @yawkat, thanks for reviewing the PR. I agree it is a niche feature and I'm not sure anyone is actively using trailers with obs-folding in practice.

Regarding your comment about expanding permitted inputs — could you clarify what you mean? The goal of this fix is not to widen the accepted input space, but to correctly implement what the original code already intended to support. The previous logic explicitly handled obs-folding in trailers, it just crashed with an UnsupportedOperationException due to calling List.set() on an AbstractList that does not override it. So the permitted inputs are unchanged in intent — the fix just makes the implementation match that intent.

I think we should merge this...

@furkanvarol did you sign our ICLA yet ? https://netty.io/s/icla

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@furkanvarol

furkanvarol commented Mar 11, 2026

Copy link
Copy Markdown
Contributor Author

@yawkat Understood — though if we decide obs-folding in trailers should not be supported, that should be an explicit rejection (e.g. a decode error) rather than relying on an accidental crash as the enforcement mechanism. Happy to go that route if preferred.

@normanmaurer yes, I already signed it :)

normanmaurer reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer
normanmaurer merged commit 9a85f9f into netty:4.2 Mar 12, 2026
34 of 35 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@netty-project-bot

netty-project-bot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

Could not create auto-port PR.
Got conflicts when cherry-picking onto 5.0.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

netty-project-bot pushed a commit that referenced this pull request Mar 12, 2026
@furkanvarol @netty-project-bot
Fix UnsupportedOperationException in readTrailingHeaders (#16412)
00eb965
Motivation:

When a chunked HTTP message contains a trailer field with a folded value
(obs-fold continuation line starting with SP or HT), readTrailingHeaders
threw UnsupportedOperationException. This happened because the folding
logic called List.set() on the list returned by
trailingHeaders().getAll(), which is an AbstractList implementation that
does not override set().

Modifications:

Changed readTrailingHeaders in HttpObjectDecoder to accumulate folded
continuation lines into the instance-level `value` field, mirroring the
pattern already used by readHeaders. The previous header is now flushed
via trailingHeaders().add() only once its complete value is assembled,
eliminating the need to mutate the list returned by getAll(). Forbidden
trailer fields (Content-Length, Transfer-Encoding, Trailer) are filtered
at flush time, consistent with the previous behaviour.

Added tests to HttpRequestDecoderTest and HttpResponseDecoderTest
covering:
- A single trailer field
- A folded trailer field with multiple SP and HT continuation lines,
followed by a non-folded trailer to verify isolation between fields
- Forbidden trailer fields interleaved with a valid one, with a
forbidden field placed last to exercise the post-loop flush path

Result:

Chunked HTTP messages with folded trailer values are now decoded
correctly instead of throwing UnsupportedOperationException.

(cherry picked from commit 9a85f9f)
@netty-project-bot netty-project-bot mentioned this pull request Mar 12, 2026
Auto-port 4.1: Fix UnsupportedOperationException in readTrailingHeaders #16437
Merged
@netty-project-bot

netty-project-bot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

Auto-port PR for 4.1: #16437

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot removed the needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. label Mar 12, 2026
normanmaurer pushed a commit that referenced this pull request Mar 12, 2026
@netty-project-bot @furkanvarol
Auto-port 4.1: Fix UnsupportedOperationException in readTrailingHeade…
2c096a0
…rs (#16437)

Auto-port of #16412 to 4.1
Cherry-picked commit: 9a85f9f

---
Motivation:

When a chunked HTTP message contains a trailer field with a folded value
(obs-fold continuation line starting with SP or HT), readTrailingHeaders
threw UnsupportedOperationException. This happened because the folding
logic called List.set() on the list returned by
trailingHeaders().getAll(), which is an AbstractList implementation that
does not override set().

Modifications:

Changed readTrailingHeaders in HttpObjectDecoder to accumulate folded
continuation lines into the instance-level `value` field, mirroring the
pattern already used by readHeaders. The previous header is now flushed
via trailingHeaders().add() only once its complete value is assembled,
eliminating the need to mutate the list returned by getAll(). Forbidden
trailer fields (Content-Length, Transfer-Encoding, Trailer) are filtered
at flush time, consistent with the previous behaviour.

Added tests to HttpRequestDecoderTest and HttpResponseDecoderTest
covering:
- A single trailer field
- A folded trailer field with multiple SP and HT continuation lines,
followed by a non-folded trailer to verify isolation between fields
- Forbidden trailer fields interleaved with a valid one, with a
forbidden field placed last to exercise the post-loop flush path

Result:

Chunked HTTP messages with folded trailer values are now decoded
correctly instead of throwing UnsupportedOperationException.

Co-authored-by: Furkan Varol <[email protected]>
chrisvest pushed a commit to chrisvest/netty that referenced this pull request Mar 12, 2026
@furkanvarol @chrisvest
Fix UnsupportedOperationException in readTrailingHeaders (netty#16412)
7151135
Motivation:

When a chunked HTTP message contains a trailer field with a folded value
(obs-fold continuation line starting with SP or HT), readTrailingHeaders
threw UnsupportedOperationException. This happened because the folding
logic called List.set() on the list returned by
trailingHeaders().getAll(), which is an AbstractList implementation that
does not override set().

Modifications:

Changed readTrailingHeaders in HttpObjectDecoder to accumulate folded
continuation lines into the instance-level `value` field, mirroring the
pattern already used by readHeaders. The previous header is now flushed
via trailingHeaders().add() only once its complete value is assembled,
eliminating the need to mutate the list returned by getAll(). Forbidden
trailer fields (Content-Length, Transfer-Encoding, Trailer) are filtered
at flush time, consistent with the previous behaviour.

Added tests to HttpRequestDecoderTest and HttpResponseDecoderTest
covering:
- A single trailer field
- A folded trailer field with multiple SP and HT continuation lines,
followed by a non-folded trailer to verify isolation between fields
- Forbidden trailer fields interleaved with a valid one, with a
forbidden field placed last to exercise the post-loop flush path

Result:

Chunked HTTP messages with folded trailer values are now decoded
correctly instead of throwing UnsupportedOperationException.

(cherry picked from commit 9a85f9f)
@chrisvest

chrisvest commented Mar 12, 2026

Copy link
Copy Markdown
Member

Port to 5.0: #16453

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chrisvest chrisvest removed the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Mar 12, 2026
normanmaurer pushed a commit that referenced this pull request Mar 13, 2026
@chrisvest @furkanvarol
Fix UnsupportedOperationException in readTrailingHeaders (#16412) (#1…
e1a4d73
…6453)

Motivation:

When a chunked HTTP message contains a trailer field with a folded value
(obs-fold continuation line starting with SP or HT), readTrailingHeaders
threw UnsupportedOperationException. This happened because the folding
logic called List.set() on the list returned by
trailingHeaders().getAll(), which is an AbstractList implementation that
does not override set().

Modifications:

Changed readTrailingHeaders in HttpObjectDecoder to accumulate folded
continuation lines into the instance-level `value` field, mirroring the
pattern already used by readHeaders. The previous header is now flushed
via trailingHeaders().add() only once its complete value is assembled,
eliminating the need to mutate the list returned by getAll(). Forbidden
trailer fields (Content-Length, Transfer-Encoding, Trailer) are filtered
at flush time, consistent with the previous behaviour.

Added tests to HttpRequestDecoderTest and HttpResponseDecoderTest
covering:
- A single trailer field
- A folded trailer field with multiple SP and HT continuation lines,
followed by a non-folded trailer to verify isolation between fields
- Forbidden trailer fields interleaved with a valid one, with a
forbidden field placed last to exercise the post-loop flush path

Result:

Chunked HTTP messages with folded trailer values are now decoded
correctly instead of throwing UnsupportedOperationException.

(cherry picked from commit 9a85f9f)

Co-authored-by: Furkan Varol <[email protected]>
This was referenced Mar 25, 2026
[SPARK-56214][BUILD] Upgrade Netty to 4.2.12.Final apache/spark#55016
Closed
[SPARK-56213] Upgrade Netty to 4.2.12.Final apache/spark-kubernetes-operator#589
Closed
dongjoon-hyun added a commit to apache/spark-kubernetes-operator that referenced this pull request Mar 25, 2026
@dongjoon-hyun
[SPARK-56213] Upgrade Netty to 4.2.12.Final
7a03aaf
### What changes were proposed in this pull request?

This PR upgrades `Netty` to 4.2.12.Final.

### Why are the changes needed?

To bring in the latest bug fixes.
- https://netty.io/news/2026/03/24/4-2-12-Final.html
  - netty/netty#16550
- https://netty.io/news/2026/03/24/4-2-11-Final.html
  - netty/netty#16489
  - netty/netty#16536
  - netty/netty#16412

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

CI should pass with the existing tests.

### Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 4.6)

Closes #589 from dongjoon-hyun/SPARK-56213.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
dongjoon-hyun added a commit to apache/spark that referenced this pull request Mar 26, 2026
@dongjoon-hyun
[SPARK-56214][BUILD] Upgrade Netty to 4.2.12.Final
f76497a
### What changes were proposed in this pull request?

This PR upgrades `Netty` to 4.2.12.Final.

### Why are the changes needed?

To bring in the latest bug fixes.
- https://netty.io/news/2026/03/24/4-2-12-Final.html
  - netty/netty#16550
- https://netty.io/news/2026/03/24/4-2-11-Final.html
  - netty/netty#16489
  - netty/netty#16536
  - netty/netty#16412

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

CI should pass with the existing tests.

### Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 4.6)

Closes #55016 from dongjoon-hyun/SPARK-56214.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
Ko-dany pushed a commit to acceldata-io/spark3 that referenced this pull request Sep 9, 2026
@dongjoon-hyun @Ko-dany
[SPARK-56214][BUILD] Upgrade Netty to 4.2.12.Final
92abe94
This PR upgrades `Netty` to 4.2.12.Final.

To bring in the latest bug fixes.
- https://netty.io/news/2026/03/24/4-2-12-Final.html
  - netty/netty#16550
- https://netty.io/news/2026/03/24/4-2-11-Final.html
  - netty/netty#16489
  - netty/netty#16536
  - netty/netty#16412

No.

CI should pass with the existing tests.

Generated-by: Claude Code (Claude Opus 4.6)

Closes apache#55016 from dongjoon-hyun/SPARK-56214.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit f76497a)
prabhjyotsingh pushed a commit to acceldata-io/spark3 that referenced this pull request Sep 10, 2026
@dongjoon-hyun @prabhjyotsingh
[SPARK-56214][BUILD] Upgrade Netty to 4.2.12.Final
9f02b88
This PR upgrades `Netty` to 4.2.12.Final.

To bring in the latest bug fixes.
- https://netty.io/news/2026/03/24/4-2-12-Final.html
  - netty/netty#16550
- https://netty.io/news/2026/03/24/4-2-11-Final.html
  - netty/netty#16489
  - netty/netty#16536
  - netty/netty#16412

No.

CI should pass with the existing tests.

Generated-by: Claude Code (Claude Opus 4.6)

Closes apache#55016 from dongjoon-hyun/SPARK-56214.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit f76497a)
@normanmaurer normanmaurer mentioned this pull request Sep 22, 2026
suspend race fix #17588
Closed
@normanmaurer normanmaurer mentioned this pull request Oct 1, 2026
child5 #17695
Closed
This was referenced Oct 20, 2026
fix iouring zerocopy iov overwrite #17936
Closed
crisp nova cceda091 #18109
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chrisvest chrisvest chrisvest left review comments
@yawkat yawkat yawkat left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

4.2.11.Final

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@furkanvarol @normanmaurer @yawkat @netty-project-bot @chrisvest @github-advanced-security
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.