|
29 | 29 | import io.netty.channel.nio.NioEventLoopGroup;
|
30 | 30 | import io.netty.channel.socket.nio.NioSocketChannel;
|
31 | 31 | import io.netty.handler.codec.http.HttpClientCodec;
|
32 |
| -import io.netty.handler.codec.http.HttpContentCompressor; |
33 | 32 | import io.netty.handler.codec.http.HttpContentDecompressor;
|
34 | 33 | import io.netty.handler.codec.http.HttpRequestEncoder;
|
35 | 34 | import io.netty.handler.codec.http.HttpResponseDecoder;
|
@@ -117,6 +116,11 @@ public Channels(final AsyncHttpClientConfig config, NettyAsyncHttpProviderConfig
|
117 | 116 | this.config = config;
|
118 | 117 | this.asyncHttpProviderConfig = asyncHttpProviderConfig;
|
119 | 118 |
|
| 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 | + |
120 | 124 | // check if external EventLoopGroup is defined
|
121 | 125 | eventLoopGroup = asyncHttpProviderConfig.getEventLoopGroup();
|
122 | 126 |
|
@@ -202,12 +206,7 @@ public void configure(final NettyChannelHandler httpProcessor) {
|
202 | 206 | plainBootstrap.handler(new ChannelInitializer<Channel>() {
|
203 | 207 | @Override
|
204 | 208 | 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()); |
211 | 210 |
|
212 | 211 | if (config.isCompressionEnabled()) {
|
213 | 212 | pipeline.addLast(INFLATER_HANDLER, new HttpContentDecompressor());
|
|
0 commit comments