Skip to content

Move http2 compression handling from connection to stream level (5.0 branch)#6080

Merged
vietj merged 1 commit intoeclipse-vertx:5.0from
zyclonite:http2_compression_5_0
Apr 21, 2026
Merged

Move http2 compression handling from connection to stream level (5.0 branch)#6080
vietj merged 1 commit intoeclipse-vertx:5.0from
zyclonite:http2_compression_5_0

Conversation

@zyclonite
Copy link
Copy Markdown
Contributor

@zyclonite zyclonite commented Apr 21, 2026

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.

@vietj
Copy link
Copy Markdown
Member

vietj commented Apr 21, 2026

can you update comment message with the full detail so it appears directly in the issue ?

@zyclonite
Copy link
Copy Markdown
Contributor Author

sure, done

@vietj vietj merged commit 93b9cde into eclipse-vertx:5.0 Apr 21, 2026
7 checks passed
@vietj
Copy link
Copy Markdown
Member

vietj commented Apr 21, 2026

perfect, thanks @zyclonite

@vietj vietj added the bug label Apr 21, 2026
@zyclonite zyclonite deleted the http2_compression_5_0 branch April 21, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants