Skip to content

Commit 10f8f09

Browse files
author
Stephane Landelle
committed
Netty Channel pool key should be (proxy +) target, close #364
1 parent 0f0f7a7 commit 10f8f09

File tree

1 file changed

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

1 file changed

+7
-4
lines changed

Diff for: providers/netty/src/main/java/org/asynchttpclient/providers/netty/channel/Channels.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,14 @@
5757
import org.asynchttpclient.AsyncHandler;
5858
import org.asynchttpclient.AsyncHttpClientConfig;
5959
import org.asynchttpclient.ConnectionPoolKeyStrategy;
60+
import org.asynchttpclient.ProxyServer;
6061
import org.asynchttpclient.providers.netty.Callback;
6162
import org.asynchttpclient.providers.netty.DiscardEvent;
6263
import org.asynchttpclient.providers.netty.NettyAsyncHttpProviderConfig;
6364
import org.asynchttpclient.providers.netty.future.NettyResponseFuture;
6465
import org.asynchttpclient.providers.netty.handler.NettyChannelHandler;
6566
import org.asynchttpclient.providers.netty.util.CleanupChannelGroup;
67+
import org.asynchttpclient.util.AsyncHttpProviderUtils;
6668
import org.asynchttpclient.util.SslUtils;
6769
import org.slf4j.Logger;
6870
import org.slf4j.LoggerFactory;
@@ -306,8 +308,7 @@ public Channel verifyChannelPipeline(Channel channel, String scheme) throws IOEx
306308

307309
protected HttpClientCodec newHttpClientCodec() {
308310
if (nettyProviderConfig != null) {
309-
return new HttpClientCodec(nettyProviderConfig.getMaxInitialLineLength(), nettyProviderConfig.getMaxHeaderSize(), nettyProviderConfig.getMaxChunkSize(),
310-
false);
311+
return new HttpClientCodec(nettyProviderConfig.getMaxInitialLineLength(), nettyProviderConfig.getMaxHeaderSize(), nettyProviderConfig.getMaxChunkSize(), false);
311312

312313
} else {
313314
return new HttpClientCodec();
@@ -444,8 +445,10 @@ public void call() throws Exception {
444445
}
445446

446447
public String getPoolKey(NettyResponseFuture<?> future) {
447-
URI uri = future.getProxyServer() != null ? future.getProxyServer().getURI() : future.getURI();
448-
return future.getConnectionPoolKeyStrategy().getKey(uri);
448+
String serverPart = future.getConnectionPoolKeyStrategy().getKey(future.getURI());
449+
450+
ProxyServer proxy = future.getProxyServer();
451+
return proxy != null ? AsyncHttpProviderUtils.getBaseUrl(proxy.getURI()) + serverPart : serverPart;
449452
}
450453

451454
public void removeAll(Channel channel) {

0 commit comments

Comments
 (0)