rschmitt commented on code in PR #699:
URL: 
https://github.com/apache/httpcomponents-client/pull/699#discussion_r2265080402


##########
httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpClientConnectionOperator.java:
##########
@@ -217,16 +218,23 @@ public void connect(
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("{} {} connected {}->{}", 
ConnPoolSupport.getId(conn), endpointHost, conn.getLocalAddress(), 
conn.getRemoteAddress());
                 }
-                conn.setSocketTimeout(soTimeout);
+                conn.setSocketTimeout(socketTimeout);
                 final TlsSocketStrategy tlsSocketStrategy = 
tlsSocketStrategyLookup != null ? 
tlsSocketStrategyLookup.lookup(endpointHost.getSchemeName()) : null;
                 if (tlsSocketStrategy != null) {
                     final NamedEndpoint tlsName = endpointName != null ? 
endpointName : endpointHost;
                     onBeforeTlsHandshake(context, endpointHost);
                     if (LOG.isDebugEnabled()) {
                         LOG.debug("{} {} upgrading to TLS", 
ConnPoolSupport.getId(conn), tlsName);
                     }
+                    final TlsConfig tlsConfig = attachment instanceof 
TlsConfig ? (TlsConfig) attachment : TlsConfig.DEFAULT;
+                    final int soTimeout = socket.getSoTimeout();
+                    final Timeout handshakeTimeout = 
tlsConfig.getHandshakeTimeout() != null ? tlsConfig.getHandshakeTimeout() : 
connectTimeout;
+                    if (handshakeTimeout != null) {
+                        
socket.setSoTimeout(handshakeTimeout.toMillisecondsIntBound());
+                    }
                     final SSLSocket sslSocket = 
tlsSocketStrategy.upgrade(socket, tlsName.getHostName(), tlsName.getPort(), 
attachment, context);
                     conn.bind(sslSocket, socket);
+                    socket.setSoTimeout(soTimeout);

Review Comment:
   I think this is much clearer than before.



##########
httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpClientConnectionOperator.java:
##########
@@ -217,16 +218,23 @@ public void connect(
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("{} {} connected {}->{}", 
ConnPoolSupport.getId(conn), endpointHost, conn.getLocalAddress(), 
conn.getRemoteAddress());
                 }
-                conn.setSocketTimeout(soTimeout);

Review Comment:
   I'm not sure what this does, since we set the socket timeout directly on the 
socket (with a null check) on line 191.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to