Skip to content

Commit 30386d3

Browse files
fitekoneaarturobernalg
authored andcommitted
HTTPCLIENT-2417 Honor TlsConfig attachment in async connect path
Make PoolingAsyncClientConnectionManager.connect() use the provided TlsConfig for direct TLS connections. (cherry picked from commit df4347f)
1 parent 9cc45f6 commit 30386d3

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,14 +487,23 @@ public Future<AsyncConnectionEndpoint> connect(
487487
if (LOG.isDebugEnabled()) {
488488
LOG.debug("{} connecting endpoint to {} ({})", ConnPoolSupport.getId(endpoint), firstHop, connectTimeout);
489489
}
490+
final Object connectAttachment;
491+
if (route.isTunnelled()) {
492+
connectAttachment = null;
493+
} else if (attachment instanceof TlsConfig) {
494+
connectAttachment = attachment;
495+
} else {
496+
connectAttachment = resolveTlsConfig(route.getTargetHost());
497+
}
498+
490499
final Future<ManagedAsyncClientConnection> connectFuture = connectionOperator.connect(
491500
connectionInitiator,
492501
firstHop,
493502
unixDomainSocket,
494503
route.getTargetName(),
495504
route.getLocalSocketAddress(),
496505
connectTimeout,
497-
route.isTunnelled() ? null : resolveTlsConfig(route.getTargetHost()),
506+
connectAttachment,
498507
context,
499508
new FutureCallback<ManagedAsyncClientConnection>() {
500509

0 commit comments

Comments
 (0)