< prev index next >

src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java

Print this page

        

@@ -1072,11 +1072,11 @@
             /* Try to open connections using the following scheme,
              * return on the first one that's successful:
              * 1) if (instProxy != null)
              *        connect to instProxy; raise exception if failed
              * 2) else use system default ProxySelector
-             * 3) is 2) fails, make direct connection
+             * 3) else make a direct connection if ProxySelector is not present
              */
 
             if (instProxy == null) { // no instance Proxy is set
                 /**
                  * Do we have to use a proxy?

@@ -1115,12 +1115,12 @@
                             break;
                         } catch (IOException ioex) {
                             if (p != Proxy.NO_PROXY) {
                                 sel.connectFailed(uri, p.address(), ioex);
                                 if (!it.hasNext()) {
-                                    // fallback to direct connection
-                                    http = getNewHttpClient(url, null, connectTimeout, false);
+                                    // re-try once with the last Proxy
+                                    http = getNewHttpClient(url, p, connectTimeout, false);
                                     http.setReadTimeout(readTimeout);
                                     break;
                                 }
                             } else {
                                 throw ioex;
< prev index next >