Skip to content

Commit df4347f

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.
1 parent cc1ef63 commit df4347f

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
@@ -502,14 +502,23 @@ public Future<AsyncConnectionEndpoint> connect(
502502
if (LOG.isDebugEnabled()) {
503503
LOG.debug("{} connecting endpoint to {} ({})", ConnPoolSupport.getId(endpoint), firstHop, connectTimeout);
504504
}
505+
final Object connectAttachment;
506+
if (route.isTunnelled()) {
507+
connectAttachment = null;
508+
} else if (attachment instanceof TlsConfig) {
509+
connectAttachment = attachment;
510+
} else {
511+
connectAttachment = resolveTlsConfig(route.getTargetHost());
512+
}
513+
505514
final Future<ManagedAsyncClientConnection> connectFuture = connectionOperator.connect(
506515
connectionInitiator,
507516
firstHop,
508517
unixDomainSocket,
509518
route.getTargetName(),
510519
route.getLocalSocketAddress(),
511520
connectTimeout,
512-
route.isTunnelled() ? null : resolveTlsConfig(route.getTargetHost()),
521+
connectAttachment,
513522
context,
514523
new FutureCallback<ManagedAsyncClientConnection>() {
515524

0 commit comments

Comments
 (0)