Skip to content

Commit fe8215b

Browse files
author
Stephane Landelle
committed
Don't enforce connection reuse on schemes other than NTLM
1 parent 3425a30 commit fe8215b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/java/com/ning/http/client/providers/netty/handler/HttpProtocol.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,18 @@ private boolean exitAfterHandling401(//
221221
if (!wwwAuthHeaders.contains("Kerberos") && (isNTLM(wwwAuthHeaders) || negociate)) {
222222
// NTLM
223223
newRealm = ntlmChallenge(wwwAuthHeaders.get(0), request, proxyServer, request.getHeaders(), realm, future, false);
224+
225+
// don't forget to reuse channel: NTLM authenticates a connection
226+
future.setReuseChannel(true);
227+
224228
} else if (negociate) {
225229
// SPNEGO KERBEROS
226230
newRealm = kerberosChallenge(channel, wwwAuthHeaders, request, proxyServer, request.getHeaders(), realm, future, false);
227231
if (newRealm == null)
228232
return true;
233+
else
234+
// don't forget to reuse channel: KERBEROS authenticates a connection
235+
future.setReuseChannel(true);
229236

230237
} else {
231238
newRealm = new Realm.RealmBuilder()//
@@ -245,8 +252,6 @@ private boolean exitAfterHandling401(//
245252
Callback callback = new Callback(future) {
246253
public void call() throws IOException {
247254
channelManager.drainChannel(channel, future);
248-
// don't forget to reuse channel: NTLM authenticates a connection
249-
future.setReuseChannel(true);
250255
requestSender.sendNextRequest(nextRequest, future);
251256
}
252257
};

0 commit comments

Comments
 (0)