From 90ee2ff33e1afeaf4eb5ccd46d5fa12214b76410 Mon Sep 17 00:00:00 2001 From: Grenville Wilson Date: Fri, 25 Nov 2016 23:45:15 -0500 Subject: [PATCH 1/2] #1094: Honoring updates to realm and proxy realm --- .../netty/request/NettyRequestSender.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/client/src/main/java/org/asynchttpclient/netty/request/NettyRequestSender.java b/client/src/main/java/org/asynchttpclient/netty/request/NettyRequestSender.java index 53b5a7e1d7..e1285c9241 100755 --- a/client/src/main/java/org/asynchttpclient/netty/request/NettyRequestSender.java +++ b/client/src/main/java/org/asynchttpclient/netty/request/NettyRequestSender.java @@ -173,20 +173,19 @@ private NettyResponseFuture newNettyRequestAndResponseFuture(final Reques ProxyServer proxy, boolean forceConnect) { Realm realm = null; - if (originalFuture != null) { + if (request.getRealm() != null) { + realm = request.getRealm(); + } else if (originalFuture.getRealm() != null) { realm = originalFuture.getRealm(); } else { - realm = request.getRealm(); - if (realm == null) { - realm = config.getRealm(); - } + realm = config.getRealm(); } Realm proxyRealm = null; - if (originalFuture != null) { - proxyRealm = originalFuture.getProxyRealm(); - } else if (proxy != null) { + if (proxy != null) { proxyRealm = proxy.getRealm(); + } else if (originalFuture != null) { + proxyRealm = originalFuture.getProxyRealm(); } NettyRequest nettyRequest = requestFactory.newNettyRequest(request, forceConnect, proxy, realm, proxyRealm); From 13e70a85f3babe14991df2b95e61e184b4bbd0cc Mon Sep 17 00:00:00 2001 From: Grenville Wilson Date: Fri, 25 Nov 2016 23:53:46 -0500 Subject: [PATCH 2/2] Forgot to check if the originalFuture is null --- .../org/asynchttpclient/netty/request/NettyRequestSender.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/main/java/org/asynchttpclient/netty/request/NettyRequestSender.java b/client/src/main/java/org/asynchttpclient/netty/request/NettyRequestSender.java index e1285c9241..e5947c77bd 100755 --- a/client/src/main/java/org/asynchttpclient/netty/request/NettyRequestSender.java +++ b/client/src/main/java/org/asynchttpclient/netty/request/NettyRequestSender.java @@ -175,7 +175,7 @@ private NettyResponseFuture newNettyRequestAndResponseFuture(final Reques Realm realm = null; if (request.getRealm() != null) { realm = request.getRealm(); - } else if (originalFuture.getRealm() != null) { + } else if (originalFuture != null && originalFuture.getRealm() != null) { realm = originalFuture.getRealm(); } else { realm = config.getRealm();