Move http2 compression handling from connection to stream level (5.0 branch)#6080
Merged
vietj merged 1 commit intoeclipse-vertx:5.0from Apr 21, 2026
Merged
Conversation
Member
|
can you update comment message with the full detail so it appears directly in the issue ? |
Contributor
Author
|
sure, done |
Member
|
perfect, thanks @zyclonite |
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.
backport on 5.0 branch from #6069
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 VertxCompressorHttp2ConnectionEncoder to store the selected encoder (compressed or plain) as a property on each Http2Stream, rather than using a mutable connection-wide delegate field.
Added testResponseCompressionEnabledMixedStreams in Http2ServerTest which 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.