From 240fd78fc15c06e1b8819df51ce6cfc1f52a38e3 Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Thu, 23 Feb 2017 12:08:44 +0000 Subject: [PATCH] 8174985: NTLM authentication doesn't work with IIS if NTLM cache is disabled Reviewed-by: aefimov, chegar, rhalade --- .../share/classes/sun/net/www/http/HttpClient.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java b/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java index a263e4137cb..57d734e5166 100644 --- a/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java +++ b/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java @@ -963,7 +963,11 @@ public class HttpClient extends NetworkClient { pi.setContentType(responses.findValue("content-type")); } - if (isKeepingAlive()) { + // If disableKeepAlive == true, the client will not be returned + // to the cache. But we still need to use a keepalive stream to + // allow the multi-message authentication exchange on the connection + boolean useKeepAliveStream = isKeepingAlive() || disableKeepAlive; + if (useKeepAliveStream) { // Wrap KeepAliveStream if keep alive is enabled. logFinest("KeepAlive stream used: " + url); serverInput = new KeepAliveStream(serverInput, pi, cl, this);