vert.x icon indicating copy to clipboard operation
vert.x copied to clipboard

Backport HTTP/2 Content-Encoding handling (#5372) to 4.x

Open Ayush0612005 opened this issue 3 weeks ago • 3 comments

Version

4.5.34 (current 4.x)

Context

#5371 (HTTP/1.x and HTTP/2 disagreeing on content encoding) was fixed for 5.0.0 by #5372, which made HTTP/2 compression skip responses that already carry Content-Encoding. 4.x doesn't have that change, so on 4.5.x a response that was already gzipped by the handler gets gzipped a second time over HTTP/2 when compression is enabled. HTTP/1.1 sends the same response unchanged.

This was reported against Quarkus 3.40 LTS, which stays on Vert.x 4.5: quarkusio/quarkus#57571. There, a Vaadin application's pre-compressed stylesheets reached the browser double-gzipped over HTTP/2. According to the report, a plain Vert.x 4.5.34 server without Quarkus fails the same way, and the same reproducer passes on Vert.x 5.1.8.

Do you have a reproducer?

https://github.com/ch-iwi/quarkus-http2-double-gzip (includes plain-vertx/PlainVertx.java, without Quarkus).

Question

Would a backport of #5372 to 4.x be acceptable? If so, I can prepare the PR with its HTTP/2 tests and a regression case for a pre-gzipped response over HTTP/2, following your preferred approach.

Ayush0612005 avatar Nov 09 '26 09:11 Ayush0612005

@Ayush0612005 yes any fix is welcome, however please spend time reviewing what your agent provide and try to find the shortest / most efficient path toward needed changes

vietj avatar Nov 09 '26 09:11 vietj

Thanks @vietj, understood. Rather than porting #5372 as a whole, I'll look for the smallest change on 4.x that stops HTTP/2 from compressing a response that already carries Content-Encoding, with a focused regression test, and I'll review it carefully myself before opening the PR. I'll link it here.

Ayush0612005 avatar Nov 09 '26 10:11 Ayush0612005

PR: #6531. Instead of porting #5372, it adds a small CompressorHttp2ConnectionEncoder subclass that skips compression for a response whose content-encoding was set by the application, deciding per stream, with a regression test that fails on HTTP/2 without the change.

Ayush0612005 avatar Nov 09 '26 10:11 Ayush0612005