Skip to content

Commit 4066b17

Browse files
author
Stephane Landelle
committed
Issue a warning when RequestCompression is enabled, see AsyncHttpClient#93
1 parent 51b10cc commit 4066b17

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/java/com/ning/http/client/providers/netty/NettyAsyncHttpProvider.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
import org.jboss.netty.handler.codec.http.HttpChunk;
8686
import org.jboss.netty.handler.codec.http.HttpChunkTrailer;
8787
import org.jboss.netty.handler.codec.http.HttpClientCodec;
88-
import org.jboss.netty.handler.codec.http.HttpContentCompressor;
8988
import org.jboss.netty.handler.codec.http.HttpContentDecompressor;
9089
import org.jboss.netty.handler.codec.http.HttpHeaders;
9190
import org.jboss.netty.handler.codec.http.HttpMethod;
@@ -159,6 +158,8 @@
159158

160159
public class NettyAsyncHttpProvider extends SimpleChannelUpstreamHandler implements AsyncHttpProvider {
161160

161+
private static final Logger LOGGER = LoggerFactory.getLogger(NettyAsyncHttpProvider.class);
162+
162163
public static final String GZIP_DEFLATE = HttpHeaders.Values.GZIP + "," + HttpHeaders.Values.DEFLATE;
163164

164165
public static final IOException REMOTELY_CLOSED_EXCEPTION = new IOException("Remotely Closed");
@@ -224,6 +225,10 @@ public NettyAsyncHttpProvider(AsyncHttpClientConfig config) {
224225
asyncHttpProviderConfig = new NettyAsyncHttpProviderConfig();
225226
}
226227

228+
if (config.getRequestCompressionLevel() > 0) {
229+
LOGGER.warn("Request was enabled but Netty actually doesn't support this feature");
230+
}
231+
227232
if (asyncHttpProviderConfig.getProperty(USE_BLOCKING_IO) != null) {
228233
socketChannelFactory = new OioClientSocketChannelFactory(config.executorService());
229234
this.allowReleaseSocketChannelFactory = true;
@@ -305,10 +310,6 @@ public ChannelPipeline getPipeline() throws Exception {
305310

306311
pipeline.addLast(HTTP_HANDLER, createHttpClientCodec());
307312

308-
if (config.getRequestCompressionLevel() > 0) {
309-
pipeline.addLast("deflater", new HttpContentCompressor(config.getRequestCompressionLevel()));
310-
}
311-
312313
if (config.isCompressionEnabled()) {
313314
pipeline.addLast("inflater", new HttpContentDecompressor());
314315
}

0 commit comments

Comments
 (0)