Skip to content

Commit e0698d4

Browse files
committed
Don't set TLS hostname for unix connections
1 parent 9b330a8 commit e0698d4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/AsyncHTTPClient/ConnectionPool.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ final class ConnectionPool {
373373
private func makeNonTSBootstrap(on eventLoop: EventLoop) throws -> NIOClientTCPBootstrap {
374374
let tlsConfiguration = configuration.tlsConfiguration ?? TLSConfiguration.forClient()
375375
let sslContext = try NIOSSLContext(configuration: tlsConfiguration)
376-
let tlsProvider = try NIOSSLClientTLSProvider<ClientBootstrap>(context: sslContext, serverHostname: key.host.isIPAddress ? nil : key.host)
376+
let tlsProvider = try NIOSSLClientTLSProvider<ClientBootstrap>(context: sslContext, serverHostname: (key.scheme == .unix || key.host.isIPAddress) ? nil : key.host)
377377
return NIOClientTCPBootstrap(ClientBootstrap(group: eventLoop), tls: tlsProvider)
378378
}
379379

@@ -420,6 +420,7 @@ final class ConnectionPool {
420420
do {
421421
bootstrap = try makeHTTPClientBootstrapBase(on: eventLoop)
422422
} catch {
423+
handshakePromise.fail(error)
423424
return eventLoop.makeFailedFuture(error)
424425
}
425426

@@ -433,7 +434,6 @@ final class ConnectionPool {
433434

434435
return channel.flatMap { channel -> EventLoopFuture<ConnectionPool.Connection> in
435436
handshakePromise.succeed(())
436-
// channel.pipeline.addSSLHandlerIfNeeded(for: self.key, tlsConfiguration: self.configuration.tlsConfiguration, handshakePromise: handshakePromise)
437437
return handshakePromise.futureResult.flatMap {
438438
channel.pipeline.addHTTPClientHandlers(leftOverBytesStrategy: .forwardBytes)
439439
}.map {

0 commit comments

Comments
 (0)