8183369: RFC unconformity of HttpURLConnection with proxy

HttpURLConnection retried with proxy if the connection fails on first attempt as per RFC

Reviewed-by: chegar, dfuchs, vtewari
This commit is contained in:
Ravi Reddy 2020-03-05 03:27:17 -05:00 committed by David Buck
parent d1818942b0
commit b2f1f73e75
2 changed files with 59 additions and 11 deletions

View file

@ -1209,7 +1209,12 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
if (p != Proxy.NO_PROXY) {
sel.connectFailed(uri, p.address(), ioex);
if (!it.hasNext()) {
throw ioex;
if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
logger.finest("Retrying with proxy: " + p.toString());
}
http = getNewHttpClient(url, p, connectTimeout, false);
http.setReadTimeout(readTimeout);
break;
}
} else {
throw ioex;