Skip to content

Commit 309af09

Browse files
author
Stephane Landelle
committed
Issue a warning when RequestCompression is enabled, see #93
1 parent d3c5b70 commit 309af09

File tree

1 file changed

+6
-7
lines changed
  • providers/netty/src/main/java/org/asynchttpclient/providers/netty/channel

1 file changed

+6
-7
lines changed

providers/netty/src/main/java/org/asynchttpclient/providers/netty/channel/Channels.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import io.netty.channel.nio.NioEventLoopGroup;
3030
import io.netty.channel.socket.nio.NioSocketChannel;
3131
import io.netty.handler.codec.http.HttpClientCodec;
32-
import io.netty.handler.codec.http.HttpContentCompressor;
3332
import io.netty.handler.codec.http.HttpContentDecompressor;
3433
import io.netty.handler.codec.http.HttpRequestEncoder;
3534
import io.netty.handler.codec.http.HttpResponseDecoder;
@@ -117,6 +116,11 @@ public Channels(final AsyncHttpClientConfig config, NettyAsyncHttpProviderConfig
117116
this.config = config;
118117
this.asyncHttpProviderConfig = asyncHttpProviderConfig;
119118

119+
// FIXME https://github.com/netty/netty/issues/2132
120+
if (config.getRequestCompressionLevel() > 0) {
121+
LOGGER.warn("Request was enabled but Netty actually doesn't support this feature, see https://github.com/netty/netty/issues/2132");
122+
}
123+
120124
// check if external EventLoopGroup is defined
121125
eventLoopGroup = asyncHttpProviderConfig.getEventLoopGroup();
122126

@@ -202,12 +206,7 @@ public void configure(final NettyChannelHandler httpProcessor) {
202206
plainBootstrap.handler(new ChannelInitializer<Channel>() {
203207
@Override
204208
protected void initChannel(Channel ch) throws Exception {
205-
ChannelPipeline pipeline = ch.pipeline()//
206-
.addLast(HTTP_HANDLER, newHttpClientCodec());
207-
208-
if (config.getRequestCompressionLevel() > 0) {
209-
pipeline.addLast(DEFLATER_HANDLER, new HttpContentCompressor(config.getRequestCompressionLevel()));
210-
}
209+
ChannelPipeline pipeline = ch.pipeline().addLast(HTTP_HANDLER, newHttpClientCodec());
211210

212211
if (config.isCompressionEnabled()) {
213212
pipeline.addLast(INFLATER_HANDLER, new HttpContentDecompressor());

0 commit comments

Comments
 (0)