HTTPCLIENT-1098: Avoid expensive reverse DNS lookup on connect timeout excpetion

Contributed by Thomas Boettcher <tboett at gmail.com>


git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1132902 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2011-06-07 08:25:24 +00:00
parent a41eccec14
commit 92d66f3355
4 changed files with 15 additions and 6 deletions

View File

@ -1,9 +1,14 @@
Changes since 4.1.1 Changes since 4.1.1
* [HTTPCLIENT-1097] BrowserCompatHostnameVerifier and StrictHostnameVerifier should handle wildcards in SSL certificates better. * [HTTPCLIENT-1098] Avoid expensive reverse DNS lookup on connect timeout exception.
Contributed by Thomas Boettcher <tboett at gmail.com>
* [HTTPCLIENT-1097] BrowserCompatHostnameVerifier and StrictHostnameVerifier should handle
wildcards in SSL certificates better.
Contributed by Sebastian Bazley <sebb at apache.org> Contributed by Sebastian Bazley <sebb at apache.org>
* [HTTPCLIENT-1092] If ClientPNames.VIRTUAL_HOST does not provide the port, derive it from the current request. * [HTTPCLIENT-1092] If ClientPNames.VIRTUAL_HOST does not provide the port, derive it from the
current request.
Contributed by Sebastian Bazley <sebb at apache.org> Contributed by Sebastian Bazley <sebb at apache.org>
* [HTTPCLIENT-1087] NTLM proxy authentication fails on retry if the underlying connection is closed * [HTTPCLIENT-1087] NTLM proxy authentication fails on retry if the underlying connection is closed

View File

@ -54,5 +54,11 @@ public class HttpInetSocketAddress extends InetSocketAddress {
public HttpHost getHost() { public HttpHost getHost() {
return this.host; return this.host;
} }
@Override
public String toString() {
return this.host.getHostName() + ":" + getPort();
}
} }

View File

@ -122,8 +122,7 @@ public class PlainSocketFactory implements SocketFactory, SchemeSocketFactory {
sock.setSoTimeout(soTimeout); sock.setSoTimeout(soTimeout);
sock.connect(remoteAddress, connTimeout); sock.connect(remoteAddress, connTimeout);
} catch (SocketTimeoutException ex) { } catch (SocketTimeoutException ex) {
throw new ConnectTimeoutException("Connect to " + remoteAddress.getHostName() + "/" throw new ConnectTimeoutException("Connect to " + remoteAddress + " timed out");
+ remoteAddress.getAddress() + " timed out");
} }
return sock; return sock;
} }

View File

@ -375,8 +375,7 @@ public class SSLSocketFactory implements LayeredSchemeSocketFactory, LayeredSock
sock.setSoTimeout(soTimeout); sock.setSoTimeout(soTimeout);
sock.connect(remoteAddress, connTimeout); sock.connect(remoteAddress, connTimeout);
} catch (SocketTimeoutException ex) { } catch (SocketTimeoutException ex) {
throw new ConnectTimeoutException("Connect to " + remoteAddress.getHostName() + "/" throw new ConnectTimeoutException("Connect to " + remoteAddress + " timed out");
+ remoteAddress.getAddress() + " timed out");
} }
SSLSocket sslsock; SSLSocket sslsock;
// Setup SSL layering if necessary // Setup SSL layering if necessary