jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
changeset 5199 98b1778f0fd1
parent 5161 bad56b1f38fb
child 5506 202f599c92aa
equal deleted inserted replaced
5198:6e8fc7a85bf2 5199:98b1778f0fd1
   247 
   247 
   248     /* Set if the user is manually setting the Authorization or Proxy-Authorization headers */
   248     /* Set if the user is manually setting the Authorization or Proxy-Authorization headers */
   249     boolean isUserServerAuth;
   249     boolean isUserServerAuth;
   250     boolean isUserProxyAuth;
   250     boolean isUserProxyAuth;
   251 
   251 
       
   252     String serverAuthKey, proxyAuthKey;
       
   253 
   252     /* Progress source */
   254     /* Progress source */
   253     protected ProgressSource pi;
   255     protected ProgressSource pi;
   254 
   256 
   255     /* all the response headers we get back */
   257     /* all the response headers we get back */
   256     private MessageHeader responses;
   258     private MessageHeader responses;
  1501                 (cl > 0 || (te != null && te.equalsIgnoreCase("chunked")))) {
  1503                 (cl > 0 || (te != null && te.equalsIgnoreCase("chunked")))) {
  1502                 errorStream = ErrorStream.getErrorStream(inputStream, cl, http);
  1504                 errorStream = ErrorStream.getErrorStream(inputStream, cl, http);
  1503             }
  1505             }
  1504             throw e;
  1506             throw e;
  1505         } finally {
  1507         } finally {
  1506             if (respCode == HTTP_PROXY_AUTH && proxyAuthentication != null) {
  1508             if (proxyAuthKey != null) {
  1507                 proxyAuthentication.endAuthRequest();
  1509                 AuthenticationInfo.endAuthRequest(proxyAuthKey);
  1508             }
  1510             }
  1509             else if (respCode == HTTP_UNAUTHORIZED && serverAuthentication != null) {
  1511             if (serverAuthKey != null) {
  1510                 serverAuthentication.endAuthRequest();
  1512                 AuthenticationInfo.endAuthRequest(serverAuthKey);
  1511             }
  1513             }
  1512         }
  1514         }
  1513     }
  1515     }
  1514 
  1516 
  1515     /*
  1517     /*
  1718                 throw new IOException("Unable to tunnel through proxy."+
  1720                 throw new IOException("Unable to tunnel through proxy."+
  1719                                       " Proxy returns \"" +
  1721                                       " Proxy returns \"" +
  1720                                       statusLine + "\"");
  1722                                       statusLine + "\"");
  1721             }
  1723             }
  1722         } finally  {
  1724         } finally  {
  1723             if (respCode == HTTP_PROXY_AUTH && proxyAuthentication != null) {
  1725             if (proxyAuthKey != null) {
  1724                 proxyAuthentication.endAuthRequest();
  1726                 AuthenticationInfo.endAuthRequest(proxyAuthKey);
  1725             }
  1727             }
  1726         }
  1728         }
  1727 
  1729 
  1728         // restore original request headers
  1730         // restore original request headers
  1729         requests = savedRequests;
  1731         requests = savedRequests;
  1835                 doingNTLMp2ndStage = true;
  1837                 doingNTLMp2ndStage = true;
  1836             }
  1838             }
  1837 
  1839 
  1838             if (realm == null)
  1840             if (realm == null)
  1839                 realm = "";
  1841                 realm = "";
  1840             ret = AuthenticationInfo.getProxyAuth(host,
  1842             proxyAuthKey = AuthenticationInfo.getProxyAuthKey(host, port, realm, authScheme);
  1841                                                   port,
  1843             ret = AuthenticationInfo.getProxyAuth(proxyAuthKey);
  1842                                                   realm,
       
  1843                                                   authScheme);
       
  1844             if (ret == null) {
  1844             if (ret == null) {
  1845                 switch (authScheme) {
  1845                 switch (authScheme) {
  1846                 case BASIC:
  1846                 case BASIC:
  1847                     InetAddress addr = null;
  1847                     InetAddress addr = null;
  1848                     try {
  1848                     try {
  1979             }
  1979             }
  1980 
  1980 
  1981             domain = p.findValue ("domain");
  1981             domain = p.findValue ("domain");
  1982             if (realm == null)
  1982             if (realm == null)
  1983                 realm = "";
  1983                 realm = "";
  1984             ret = AuthenticationInfo.getServerAuth(url, realm, authScheme);
  1984             serverAuthKey = AuthenticationInfo.getServerAuthKey(url, realm, authScheme);
       
  1985             ret = AuthenticationInfo.getServerAuth(serverAuthKey);
  1985             InetAddress addr = null;
  1986             InetAddress addr = null;
  1986             if (ret == null) {
  1987             if (ret == null) {
  1987                 try {
  1988                 try {
  1988                     addr = InetAddress.getByName(url.getHost());
  1989                     addr = InetAddress.getByName(url.getHost());
  1989                 } catch (java.net.UnknownHostException ignored) {
  1990                 } catch (java.net.UnknownHostException ignored) {