From 262fec5203428cf7e46629eba130a0b5f6136a4e Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Wed, 6 Aug 2014 14:14:45 +0000 Subject: [PATCH] HTTPCLIENT-1535: Permit other addresses to be tried in the event of a NoRouteToHostException. e.g. when there one of the addresses to be used is an ipv6 address when the client does not have an ipv6 route to that particular host git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1616239 13f79535-47bb-0310-9956-ffa450edef68 --- .../http/impl/conn/DefaultHttpClientConnectionOperator.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpClientConnectionOperator.java b/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpClientConnectionOperator.java index 17e8f31d7..aef638c82 100644 --- a/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpClientConnectionOperator.java +++ b/httpclient/src/main/java/org/apache/http/impl/conn/DefaultHttpClientConnectionOperator.java @@ -28,6 +28,7 @@ import java.io.IOException; import java.net.ConnectException; +import java.net.NoRouteToHostException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; @@ -150,6 +151,10 @@ public void connect( throw new HttpHostConnectException(ex, host, addresses); } } + } catch (final NoRouteToHostException ex) { + if (last) { + throw ex; + } } if (this.log.isDebugEnabled()) { this.log.debug("Connect to " + remoteAddress + " timed out. " +