Fix Http2 server - compressed and uncompressed responses over same connection#6069
Merged
vietj merged 1 commit intoeclipse-vertx:masterfrom Apr 21, 2026
Merged
Conversation
ffa2a87 to
e40fc7e
Compare
Member
|
rebased since I've done fixes to improve test passing more consistently |
Contributor
Author
|
thank you, with a small assertion fix it was successful |
Contributor
Author
vietj
reviewed
Apr 20, 2026
Member
|
can you make a single commit and explain what has changed and how it solves the issue ? basically I'm looking for a commit Motivation: Changes: Results: that helps reviewing :-) |
4736fbf to
9f3ea51
Compare
9f3ea51 to
7780a0d
Compare
Contributor
Author
|
fixed the PR based on your input |
Member
|
excellent @zyclonite |
Member
|
can you backport this PR @zyclonite ? |
Contributor
Author
|
sure, onto the 5.0 branch - in 4.x this was not an issue |
Contributor
Author
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.
Motivation:
This PR fixes #5896 by allowing multiple concurrent HTTP/2 streams on the same connection to independently select their encoder (compressed vs. plain) based on their own headers, without interfering with each other.
This problem surfaced when different browsers connect via a HTTP/2 enabled proxy that multiplexes multiple connections into one single HTTP/2 connection. If one client supports compression and another not, the server sends the proper headers but the wrong payload, triggering decompression errors.
Changes:
Refactored
VertxCompressorHttp2ConnectionEncoderto store the selected encoder (compressed or plain) as a property on eachHttp2Stream, rather than using a mutable connection-wide delegate field.Added
testResponseCompressionEnabledMixedStreamsinHttp2ServerTestwhich verifies that each stream independently receives the correct compression behavior.Results:
Each HTTP/2 stream now independently selects its encoder at header-write time, and subsequent data frames use that same encoder. Concurrent streams with different compression requirements on the same connection are handled correctly. Stream property lifecycle is managed automatically by Netty when streams are closed.