Repository navigation
Drop the fallback for Netty before 4.2.17 - #2396
Merged
hyperxpro merged 2 commits intoNov 21, 2026
Merged
Conversation
Without Netty's pull-based Decompressor API, which Netty added in 4.2.17, Http1ContentDecompressor left br, zstd and snappy to HttpContentDecompressor, which decompresses them as soon as they are read. AHC declares a newer Netty, so the fallback goes, and with it the test that hid the API with a class loader. PullDecompression still checks whether Brotli and zstd are available, since brotli4j and zstd-jni are optional: a body whose library is missing is still left undecoded, as HttpContentDecompressor does. The README and the Javadoc no longer describe the fallback. Claude Code on behalf of Matthias Kurz Co-Authored-By: Claude Opus 5.5 <[email protected]>
hyperxpro
requested changes
Nov 20, 2026
With Netty older than 4.2.17, br, zstd and snappy responses now fail instead of being decompressed as soon as they are read. Say in the README that AHC needs Netty 4.2.17 or later. Claude Code on behalf of Matthias Kurz Co-Authored-By: Claude Opus 5.5 <[email protected]>
hyperxpro
approved these changes
Nov 21, 2026
mkurz
added a commit
to mkurz/async-http-client
that referenced
this pull request
Nov 21, 2026
Brings in AsyncHttpClient#2396, which conflicts with this branch in the README, the Javadoc of ResponseBodyControl.suspend() and the class Javadoc of Http1ContentDecompressor, and AsyncHttpClient#2394, which changed the same files. The resolution keeps the Netty 4.2.17 requirement from AsyncHttpClient#2396 and the note on Netty 4.2.21 from this branch. As this branch no longer sends zstd to HttpContentDecompressor, it also drops the clause on Zstd bodies decompressed as soon as they are read from the README's paragraph on truncated bodies, which merged without a conflict. Claude Code on behalf of Matthias Kurz Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Summary
br,zstdandsnappybodies with Netty's pull-basedDecompressorAPI, so that they wait for demand. Netty added that API in 4.2.17. With an older Netty,Http1ContentDecompressorcaught theLinkageErrorand left these codings toHttpContentDecompressor, which decompresses them as soon as they are read.main, 4.2.21 with Upgrade Netty to 4.2.21.Final #2395), so this PR drops that fallback. The README now says that AHC needs Netty 4.2.17 or later.Change
Http1ContentDecompressor: thepullAvailableflag and theLinkageErrorcatch go.newPullDecompressionnow only creates thePullDecompression.PullDecompression.createstill checks whether Brotli and zstd are available, since brotli4j and zstd-jni are optional dependencies. A body whose library is missing is still left undecoded, asHttpContentDecompressordoes.gzipAndDeflateDoNotNeedNettysDecompressorApigoes, together with the class loader that hid the API from it, as an older Netty would.ResponseBodyControl.suspend()and the class Javadoc ofHttp1ContentDecompressorandPullDecompressionno longer describe the fallback. The README now says that AHC needs Netty 4.2.17 or later, as it uses the API Netty added there, and that on-demand decompression applies over HTTP/1.1, and its paragraph on truncated bodies no longer names Brotli and Snappy bodies decompressed as soon as they are read.PullDecompressionstill notes that Netty marks the API@UnstableApi, so a Netty upgrade may require changes there.Notes
ResponseBodyControl.suspend()and the class Javadoc ofHttp1ContentDecompressor. Upgrade Netty to 4.2.21.Final #2395 removes the exception forzstdat a non-positiveio.netty.compression.defaultMaxForwardBytes, which this PR keeps. Whichever is merged second, I'll mergemaininto it and resolve that.AI disclosure
Claude Code on behalf of Matthias Kurz. The commit includes
Co-Authored-ByperAGENTS.md.Test plan
./mvnw -B -ntp -Dgpg.skip=true clean verifyon JDK 11: 2,097 tests, 0 failures, 0 errors, 11 skipped; Revapi passed. No test-skipping flags were used. That is one test fewer than onmain: the removed class loader test.Http1ContentDecompressor*Test,Http2ContentDecompressorTest,Http1Decompression*TestandResponseBodyControlTestclasses: 141 tests, 0 failures.82fde4d68), the sameclean verify: 2,097 tests, 0 failures, 0 errors, 22 skipped; Revapi passed. Docker was not running, so the 11 Testcontainers proxy tests skipped themselves; they ran and passed with32bb77670(2,097 tests, 11 skipped).-Dnetty.version=4.2.17.Final, all client tests (./mvnw -pl client clean test, JDK 11): 2,097 tests, 2 failures, both in tests that compare AHC's output and read requests with Netty's own decoders, which changed after 4.2.17 (decodesLikeNettyForEveryBodyAndSplit,requestsReadsLikeNettyWhenAutoReadIsOff).