Skip to content

Commit 248ad2a

Browse files
committed
Don't set TLS hostname for unix connections
1 parent 1216dc5 commit 248ad2a

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
@@ -376,7 +376,7 @@ final class ConnectionPool {
376376
private func makeNonTSBootstrap(on eventLoop: EventLoop) throws -> NIOClientTCPBootstrap {
377377
let tlsConfiguration = configuration.tlsConfiguration ?? TLSConfiguration.forClient()
378378
let sslContext = try NIOSSLContext(configuration: tlsConfiguration)
379-
let tlsProvider = try NIOSSLClientTLSProvider<ClientBootstrap>(context: sslContext, serverHostname: key.host.isIPAddress ? nil : key.host)
379+
let tlsProvider = try NIOSSLClientTLSProvider<ClientBootstrap>(context: sslContext, serverHostname: (key.scheme == .unix || key.host.isIPAddress) ? nil : key.host)
380380
return NIOClientTCPBootstrap(ClientBootstrap(group: eventLoop), tls: tlsProvider)
381381
}
382382

@@ -423,6 +423,7 @@ final class ConnectionPool {
423423
do {
424424
bootstrap = try makeHTTPClientBootstrapBase(on: eventLoop)
425425
} catch {
426+
handshakePromise.fail(error)
426427
return eventLoop.makeFailedFuture(error)
427428
}
428429

@@ -436,7 +437,6 @@ final class ConnectionPool {
436437

437438
return channel.flatMap { channel -> EventLoopFuture<ConnectionPool.Connection> in
438439
handshakePromise.succeed(())
439-
// channel.pipeline.addSSLHandlerIfNeeded(for: self.key, tlsConfiguration: self.configuration.tlsConfiguration, handshakePromise: handshakePromise)
440440
return handshakePromise.futureResult.flatMap {
441441
channel.pipeline.addHTTPClientHandlers(leftOverBytesStrategy: .forwardBytes)
442442
}.map {

0 commit comments

Comments
 (0)