File tree 2 files changed +33
-19
lines changed
2 files changed +33
-19
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ import Logging
17
17
import NIO
18
18
import NIOConcurrencyHelpers
19
19
import NIOHTTP1
20
- import NIOHTTPCompression
21
20
import NIOSSL
22
21
import NIOTLS
23
22
import NIOTransportServices
@@ -456,28 +455,12 @@ class HTTP1ConnectionProvider {
456
455
let connectionID = HTTPConnectionPool . Connection. ID. globalGenerator. next ( )
457
456
let eventLoop = preference. bestEventLoop ?? self . eventLoop
458
457
let deadline = NIODeadline . now ( ) + ( self . configuration. timeout. connect ?? . seconds( 10 ) )
459
- return self . factory. makeChannel (
458
+ return self . factory. makeHTTP1Channel (
460
459
connectionID: connectionID,
461
460
deadline: deadline,
462
461
eventLoop: eventLoop,
463
462
logger: logger
464
- ) . flatMapThrowing {
465
- ( channel, _) -> Channel in
466
-
467
- // add the http1.1 channel handlers
468
- let syncOperations = channel. pipeline. syncOperations
469
- try syncOperations. addHTTPClientHandlers ( leftOverBytesStrategy: . forwardBytes)
470
-
471
- switch self . configuration. decompression {
472
- case . disabled:
473
- ( )
474
- case . enabled( let limit) :
475
- let decompressHandler = NIOHTTPResponseDecompressor ( limit: limit)
476
- try syncOperations. addHandler ( decompressHandler)
477
- }
478
-
479
- return channel
480
- }
463
+ )
481
464
}
482
465
483
466
/// A `Waiter` represents a request that waits for a connection when none is
Original file line number Diff line number Diff line change 15
15
import Logging
16
16
import NIO
17
17
import NIOHTTP1
18
+ import NIOHTTPCompression
18
19
import NIOSOCKS
19
20
import NIOSSL
20
21
import NIOTLS
@@ -47,6 +48,36 @@ extension HTTPConnectionPool {
47
48
}
48
49
49
50
extension HTTPConnectionPool . ConnectionFactory {
51
+ func makeHTTP1Channel(
52
+ connectionID: HTTPConnectionPool . Connection . ID ,
53
+ deadline: NIODeadline ,
54
+ eventLoop: EventLoop ,
55
+ logger: Logger
56
+ ) -> EventLoopFuture < Channel > {
57
+ self . makeChannel (
58
+ connectionID: connectionID,
59
+ deadline: deadline,
60
+ eventLoop: eventLoop,
61
+ logger: logger
62
+ ) . flatMapThrowing {
63
+ ( channel, _) -> Channel in
64
+
65
+ // add the http1.1 channel handlers
66
+ let syncOperations = channel. pipeline. syncOperations
67
+ try syncOperations. addHTTPClientHandlers ( leftOverBytesStrategy: . forwardBytes)
68
+
69
+ switch self . clientConfiguration. decompression {
70
+ case . disabled:
71
+ ( )
72
+ case . enabled( let limit) :
73
+ let decompressHandler = NIOHTTPResponseDecompressor ( limit: limit)
74
+ try syncOperations. addHandler ( decompressHandler)
75
+ }
76
+
77
+ return channel
78
+ }
79
+ }
80
+
50
81
func makeChannel(
51
82
connectionID: HTTPConnectionPool . Connection . ID ,
52
83
deadline: NIODeadline ,
You can’t perform that action at this time.
0 commit comments