8225298: Improve TLS connection support
authorchegar
Fri, 21 Jun 2019 10:51:10 +0100
changeset 58630 6b93cc7741ba
parent 58629 2ede50a0f67d
child 58631 36c5e85b8597
8225298: Improve TLS connection support Reviewed-by: dfuchs, igerasim, michaelm, rhalade, skoivu
src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
--- a/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Wed Jun 19 15:24:42 2019 -0700
+++ b/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Fri Jun 21 10:51:10 2019 +0100
@@ -2171,6 +2171,10 @@
             } while (retryTunnel < maxRedirects);
 
             if (retryTunnel >= maxRedirects || (respCode != HTTP_OK)) {
+                if (respCode != HTTP_PROXY_AUTH) {
+                    // remove all but authenticate responses
+                    responses.reset();
+                }
                 throw new IOException("Unable to tunnel through proxy."+
                                       " Proxy returns \"" +
                                       statusLine + "\"");