src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
Print this page
@@ -247,10 +247,12 @@
/* Set if the user is manually setting the Authorization or Proxy-Authorization headers */
boolean isUserServerAuth;
boolean isUserProxyAuth;
+ String serverAuthKey, proxyAuthKey;
+
/* Progress source */
protected ProgressSource pi;
/* all the response headers we get back */
private MessageHeader responses;
@@ -1501,15 +1503,15 @@
(cl > 0 || (te != null && te.equalsIgnoreCase("chunked")))) {
errorStream = ErrorStream.getErrorStream(inputStream, cl, http);
}
throw e;
} finally {
- if (respCode == HTTP_PROXY_AUTH && proxyAuthentication != null) {
- proxyAuthentication.endAuthRequest();
+ if (proxyAuthKey != null) {
+ AuthenticationInfo.endAuthRequest(proxyAuthKey);
}
- else if (respCode == HTTP_UNAUTHORIZED && serverAuthentication != null) {
- serverAuthentication.endAuthRequest();
+ if (serverAuthKey != null) {
+ AuthenticationInfo.endAuthRequest(serverAuthKey);
}
}
}
/*
@@ -1718,12 +1720,12 @@
throw new IOException("Unable to tunnel through proxy."+
" Proxy returns \"" +
statusLine + "\"");
}
} finally {
- if (respCode == HTTP_PROXY_AUTH && proxyAuthentication != null) {
- proxyAuthentication.endAuthRequest();
+ if (proxyAuthKey != null) {
+ AuthenticationInfo.endAuthRequest(proxyAuthKey);
}
}
// restore original request headers
requests = savedRequests;
@@ -1835,14 +1837,12 @@
doingNTLMp2ndStage = true;
}
if (realm == null)
realm = "";
- ret = AuthenticationInfo.getProxyAuth(host,
- port,
- realm,
- authScheme);
+ proxyAuthKey = AuthenticationInfo.getProxyAuthKey(host, port, realm, authScheme);
+ ret = AuthenticationInfo.getProxyAuth(proxyAuthKey);
if (ret == null) {
switch (authScheme) {
case BASIC:
InetAddress addr = null;
try {
@@ -1979,11 +1979,12 @@
}
domain = p.findValue ("domain");
if (realm == null)
realm = "";
- ret = AuthenticationInfo.getServerAuth(url, realm, authScheme);
+ serverAuthKey = AuthenticationInfo.getServerAuthKey(url, realm, authScheme);
+ ret = AuthenticationInfo.getServerAuth(serverAuthKey);
InetAddress addr = null;
if (ret == null) {
try {
addr = InetAddress.getByName(url.getHost());
} catch (java.net.UnknownHostException ignored) {