HTTPCLIENT-2099, HTTPCLIENT-2091: SSLConnectionSocketFactory connect timeout fix (#241)

SSLConnectionSocketFactory no longer overrides the socket timeout
with the connect timeout when an unlimited socket timeout is
configured. This matches behavior of HTTPCLIENT-2091.

Note that in scenarios where SocketConfig sets an infinite timeout
and the RequestConfig sets a bounded timeout, this change results
in the connect-timeout no longer applying to the TLS handshake.
This behavior can be retained by setting the expected timeout in
the SocketConfig.
This commit is contained in:
Carter Kozak 2020-07-11 11:18:42 -04:00 committed by GitHub
parent a0a2ae0559
commit 5bdcb242f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 3 deletions

View File

@ -207,9 +207,6 @@ public class SSLConnectionSocketFactory implements LayeredConnectionSocketFactor
sock.bind(localAddress);
}
try {
if (TimeValue.isPositive(connectTimeout) && sock.getSoTimeout() == 0) {
sock.setSoTimeout(connectTimeout.toMillisecondsIntBound());
}
if (LOG.isDebugEnabled()) {
LOG.debug("Connecting socket to {} with timeout {}", remoteAddress, connectTimeout);
}