Skip to content

HTTPCLIENT-2386: Classic transport to use connect timeout as a default if TLS timeout has not been explicitly set#699

Merged
ok2c merged 1 commit into
apache:5.5.xfrom
ok2c:HTTPCLIENT-2386
Aug 10, 2025
Merged

HTTPCLIENT-2386: Classic transport to use connect timeout as a default if TLS timeout has not been explicitly set#699
ok2c merged 1 commit into
apache:5.5.xfrom
ok2c:HTTPCLIENT-2386

Conversation

@ok2c

@ok2c ok2c commented Aug 5, 2025

Copy link
Copy Markdown
Member

This change-set re-aligns the behavior of the classic and async connection operators and makes both transports use connect timeout as a fallback value for the TLS timeout when explicitly set.

@arturobernalg arturobernalg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@garydgregory

Copy link
Copy Markdown
Member

👍 I think this will help a lot of users that get confused by what timeout kicks in when.

@rschmitt rschmitt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the original soTimeout restored after the handshake is completed?

@ok2c ok2c force-pushed the HTTPCLIENT-2386 branch from 88c19c0 to 948be67 Compare August 7, 2025 08:08
…t if TLS timeout has not been explicitly set
@ok2c ok2c force-pushed the HTTPCLIENT-2386 branch from 948be67 to 7e32fec Compare August 7, 2025 08:14
@ok2c

ok2c commented Aug 7, 2025

Copy link
Copy Markdown
Member Author

Where is the original soTimeout restored after the handshake is completed?

@rschmitt Good catch. Please do another pass.

@ok2c

ok2c commented Aug 9, 2025

Copy link
Copy Markdown
Member Author

@rschmitt Any objections to committing this change-set?

if (LOG.isDebugEnabled()) {
LOG.debug("{} {} connected {}->{}", ConnPoolSupport.getId(conn), endpointHost, conn.getLocalAddress(), conn.getRemoteAddress());
}
conn.setSocketTimeout(soTimeout);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines +233 to +237
socket.setSoTimeout(handshakeTimeout.toMillisecondsIntBound());
}
final SSLSocket sslSocket = tlsSocketStrategy.upgrade(socket, tlsName.getHostName(), tlsName.getPort(), attachment, context);
conn.bind(sslSocket, socket);
socket.setSoTimeout(soTimeout);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is much clearer than before.

@ok2c ok2c merged commit 6d4e503 into apache:5.5.x Aug 10, 2025
8 checks passed
@ok2c ok2c deleted the HTTPCLIENT-2386 branch August 10, 2025 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants