Skip to content

Commit 5b1e697

Browse files
author
Stephane Landelle
committed
Don't enforce connection reuse on schemes other than NTLM
1 parent 963f7ef commit 5b1e697

File tree

1 file changed

+8
-2
lines changed
  • providers/netty/src/main/java/org/asynchttpclient/providers/netty/handler

1 file changed

+8
-2
lines changed

providers/netty/src/main/java/org/asynchttpclient/providers/netty/handler/HttpProtocol.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,19 @@ private boolean exitAfterHandling401(//
207207
if (!wwwAuthHeaders.contains("Kerberos") && (isNTLM(wwwAuthHeaders) || negociate)) {
208208
// NTLM
209209
newRealm = ntlmChallenge(wwwAuthHeaders.get(0), request, proxyServer, request.getHeaders(), realm, future, false);
210+
211+
// don't forget to reuse channel: NTLM authenticates a connection
212+
future.setReuseChannel(true);
213+
210214
} else if (negociate) {
211215
newRealm = kerberosChallenge(channel, wwwAuthHeaders, request, proxyServer, request.getHeaders(), realm, future, false);
212216
// SPNEGO KERBEROS
213217
if (newRealm == null)
214218
return true;
219+
else
220+
// don't forget to reuse channel: KERBEROS authenticates a connection
221+
future.setReuseChannel(true);
222+
215223
} else {
216224
newRealm = new Realm.RealmBuilder()//
217225
.clone(realm)//
@@ -230,8 +238,6 @@ private boolean exitAfterHandling401(//
230238
Callback callback = new Callback(future) {
231239
public void call() throws IOException {
232240
channelManager.drainChannel(channel, future);
233-
// don't forget to reuse channel: NTLM authenticates a connection
234-
future.setReuseChannel(true);
235241
requestSender.sendNextRequest(nextRequest, future);
236242
}
237243
};

0 commit comments

Comments
 (0)