@@ -47,8 +47,7 @@ extension HTTPConnectionPool {
47
47
}
48
48
49
49
extension HTTPConnectionPool . ConnectionFactory {
50
- func makeBestChannel( connectionID: HTTPConnectionPool . Connection . ID , eventLoop: EventLoop , logger: Logger ) -> EventLoopFuture < ( Channel , HTTPVersion ) > {
51
-
50
+ func makeChannel( connectionID: HTTPConnectionPool . Connection . ID , eventLoop: EventLoop , logger: Logger ) -> EventLoopFuture < ( Channel , HTTPVersion ) > {
52
51
if self . key. scheme. isProxyable, let proxy = self . clientConfiguration. proxy {
53
52
switch proxy. type {
54
53
case . socks:
@@ -57,11 +56,11 @@ extension HTTPConnectionPool.ConnectionFactory {
57
56
return self . makeHTTPProxyChannel ( proxy, connectionID: connectionID, eventLoop: eventLoop, logger: logger)
58
57
}
59
58
} else {
60
- return self . makeChannel ( eventLoop: eventLoop, logger: logger)
59
+ return self . makeNonProxiedChannel ( eventLoop: eventLoop, logger: logger)
61
60
}
62
61
}
63
62
64
- private func makeChannel ( eventLoop: EventLoop , logger: Logger ) -> EventLoopFuture < ( Channel , HTTPVersion ) > {
63
+ private func makeNonProxiedChannel ( eventLoop: EventLoop , logger: Logger ) -> EventLoopFuture < ( Channel , HTTPVersion ) > {
65
64
switch self . key. scheme {
66
65
case . http, . http_unix, . unix:
67
66
return self . makePlainChannel ( eventLoop: eventLoop) . map { ( $0, . http1_1) }
@@ -128,7 +127,7 @@ extension HTTPConnectionPool.ConnectionFactory {
128
127
}
129
128
}
130
129
}
131
-
130
+
132
131
private func makeSOCKSProxyChannel(
133
132
_ proxy: HTTPClient . Configuration . Proxy ,
134
133
connectionID: HTTPConnectionPool . Connection . ID ,
@@ -144,7 +143,8 @@ extension HTTPConnectionPool.ConnectionFactory {
144
143
145
144
let socksConnectHandler = SOCKSClientHandler (
146
145
targetAddress: . domain( self . key. host, port: self . key. port) ,
147
- connectionEstablishedPromise: connectionEstablishedPromise)
146
+ connectionEstablishedPromise: connectionEstablishedPromise
147
+ )
148
148
149
149
do {
150
150
try channel. pipeline. syncOperations. addHandler ( socksConnectHandler)
@@ -159,7 +159,7 @@ extension HTTPConnectionPool.ConnectionFactory {
159
159
}
160
160
}
161
161
}
162
-
162
+
163
163
private func setupTLSInProxyConnectionIfNeeded( _ channel: Channel , logger: Logger ) -> EventLoopFuture < ( Channel , HTTPVersion ) > {
164
164
switch self . key. scheme {
165
165
case . unix, . http_unix, . https_unix:
@@ -301,9 +301,8 @@ extension HTTPConnectionPool.ConnectionFactory {
301
301
. addTimeoutIfNeeded ( self . clientConfiguration. timeout)
302
302
. channelInitializer { channel in
303
303
sslContextFuture. flatMap { ( sslContext) -> EventLoopFuture < Void > in
304
- let sync = channel. pipeline. syncOperations
305
-
306
304
do {
305
+ let sync = channel. pipeline. syncOperations
307
306
let sslHandler = try NIOSSLClientHandler (
308
307
context: sslContext,
309
308
serverHostname: hostname
0 commit comments