@@ -16,7 +16,6 @@ import Foundation
16
16
import NIO
17
17
import NIOConcurrencyHelpers
18
18
import NIOHTTP1
19
- import NIOSSL
20
19
import NIOTransportServices
21
20
import NIOTLS
22
21
@@ -373,31 +372,6 @@ final class ConnectionPool {
373
372
}
374
373
}
375
374
376
- // if the configuration includes a proxy and requires TLS, TLS will not have been enabled yet. This
377
- // returns whether we need to call addSSLHandlerIfNeeded().
378
- private func requiresSSLHandler( on eventLoop: EventLoop ) -> Bool {
379
- // if a proxy is not set return false, otherwise for non-TS situation return true, if TS is available and
380
- // either we don't have an NIOTSEventLoop or the scheme is HTTPS then return true
381
- if self . configuration. proxy != nil {
382
- #if canImport(Network)
383
- if #available( OSX 10 . 14 , iOS 12 . 0 , tvOS 12 . 0 , watchOS 6 . 0 , * )
384
- {
385
- if !( eventLoop is NIOTSEventLoop ) {
386
- return true
387
- }
388
- if self . key. scheme == . https {
389
- return true
390
- }
391
- } else {
392
- return true
393
- }
394
- #else
395
- return true
396
- #endif
397
- }
398
- return false
399
- }
400
-
401
375
private func makeConnection( on eventLoop: EventLoop ) -> EventLoopFuture < Connection > {
402
376
self . activityPrecondition ( expected: [ . opened] )
403
377
let address = HTTPClient . resolveAddress ( host: self . key. host, port: self . key. port, proxy: self . configuration. proxy)
@@ -419,8 +393,8 @@ final class ConnectionPool {
419
393
}
420
394
421
395
return channel. flatMap { channel -> EventLoopFuture < ConnectionPool . Connection > in
422
-
423
- channel. pipeline. addSSLHandlerIfNeeded ( for: self . key, tlsConfiguration: self . configuration. tlsConfiguration, addSSLClient: self . requiresSSLHandler ( on : eventLoop ) , handshakePromise: handshakePromise)
396
+ let requiresSSLHandler = self . configuration . proxy != nil && self . key . scheme == . https
397
+ channel. pipeline. addSSLHandlerIfNeeded ( for: self . key, tlsConfiguration: self . configuration. tlsConfiguration, addSSLClient: requiresSSLHandler, handshakePromise: handshakePromise)
424
398
return handshakePromise. futureResult. flatMap {
425
399
channel. pipeline. addHTTPClientHandlers ( leftOverBytesStrategy: . forwardBytes)
426
400
} . map {
0 commit comments