@@ -847,14 +847,32 @@ public class HTTPClient {
847
847
/// By default, don't use it
848
848
public var enableMultipath : Bool
849
849
850
+ /// A method with access to the HTTP/1 connection channel that is called when creating the connection.
851
+ public var http1_1ConnectionDebugInitializer :
852
+ ( @Sendable ( Channel ) -> EventLoopFuture < Void > ) ?
853
+
854
+ /// A method with access to the HTTP/2 connection channel that is called when creating the connection.
855
+ public var http2ConnectionDebugInitializer :
856
+ ( @Sendable ( Channel ) -> EventLoopFuture < Void > ) ?
857
+
858
+ /// A method with access to the HTTP/2 stream channel that is called when creating the stream.
859
+ public var http2StreamChannelDebugInitializer :
860
+ ( @Sendable ( Channel ) -> EventLoopFuture < Void > ) ?
861
+
850
862
public init (
851
863
tlsConfiguration: TLSConfiguration ? = nil ,
852
864
redirectConfiguration: RedirectConfiguration ? = nil ,
853
865
timeout: Timeout = Timeout ( ) ,
854
866
connectionPool: ConnectionPool = ConnectionPool ( ) ,
855
867
proxy: Proxy ? = nil ,
856
868
ignoreUncleanSSLShutdown: Bool = false ,
857
- decompression: Decompression = . disabled
869
+ decompression: Decompression = . disabled,
870
+ http1_1ConnectionDebugInitializer:
871
+ ( @Sendable ( Channel ) -> EventLoopFuture < Void > ) ? = nil ,
872
+ http2ConnectionDebugInitializer:
873
+ ( @Sendable ( Channel ) -> EventLoopFuture < Void > ) ? = nil ,
874
+ http2StreamChannelDebugInitializer:
875
+ ( @Sendable ( Channel ) -> EventLoopFuture < Void > ) ? = nil
858
876
) {
859
877
self . tlsConfiguration = tlsConfiguration
860
878
self . redirectConfiguration = redirectConfiguration ?? RedirectConfiguration ( )
@@ -865,6 +883,9 @@ public class HTTPClient {
865
883
self . httpVersion = . automatic
866
884
self . networkFrameworkWaitForConnectivity = true
867
885
self . enableMultipath = false
886
+ self . http1_1ConnectionDebugInitializer = http1_1ConnectionDebugInitializer
887
+ self . http2ConnectionDebugInitializer = http2ConnectionDebugInitializer
888
+ self . http2StreamChannelDebugInitializer = http2StreamChannelDebugInitializer
868
889
}
869
890
870
891
public init (
@@ -873,7 +894,13 @@ public class HTTPClient {
873
894
timeout: Timeout = Timeout ( ) ,
874
895
proxy: Proxy ? = nil ,
875
896
ignoreUncleanSSLShutdown: Bool = false ,
876
- decompression: Decompression = . disabled
897
+ decompression: Decompression = . disabled,
898
+ http1_1ConnectionDebugInitializer:
899
+ ( @Sendable ( Channel ) -> EventLoopFuture < Void > ) ? = nil ,
900
+ http2ConnectionDebugInitializer:
901
+ ( @Sendable ( Channel ) -> EventLoopFuture < Void > ) ? = nil ,
902
+ http2StreamChannelDebugInitializer:
903
+ ( @Sendable ( Channel ) -> EventLoopFuture < Void > ) ? = nil
877
904
) {
878
905
self . init (
879
906
tlsConfiguration: tlsConfiguration,
@@ -882,7 +909,10 @@ public class HTTPClient {
882
909
connectionPool: ConnectionPool ( ) ,
883
910
proxy: proxy,
884
911
ignoreUncleanSSLShutdown: ignoreUncleanSSLShutdown,
885
- decompression: decompression
912
+ decompression: decompression,
913
+ http1_1ConnectionDebugInitializer: http1_1ConnectionDebugInitializer,
914
+ http2ConnectionDebugInitializer: http2ConnectionDebugInitializer,
915
+ http2StreamChannelDebugInitializer: http2StreamChannelDebugInitializer
886
916
)
887
917
}
888
918
@@ -893,7 +923,13 @@ public class HTTPClient {
893
923
maximumAllowedIdleTimeInConnectionPool: TimeAmount = . seconds( 60 ) ,
894
924
proxy: Proxy ? = nil ,
895
925
ignoreUncleanSSLShutdown: Bool = false ,
896
- decompression: Decompression = . disabled
926
+ decompression: Decompression = . disabled,
927
+ http1_1ConnectionDebugInitializer:
928
+ ( @Sendable ( Channel ) -> EventLoopFuture < Void > ) ? = nil ,
929
+ http2ConnectionDebugInitializer:
930
+ ( @Sendable ( Channel ) -> EventLoopFuture < Void > ) ? = nil ,
931
+ http2StreamChannelDebugInitializer:
932
+ ( @Sendable ( Channel ) -> EventLoopFuture < Void > ) ? = nil
897
933
) {
898
934
var tlsConfig = TLSConfiguration . makeClientConfiguration ( )
899
935
tlsConfig. certificateVerification = certificateVerification
@@ -904,7 +940,10 @@ public class HTTPClient {
904
940
connectionPool: ConnectionPool ( idleTimeout: maximumAllowedIdleTimeInConnectionPool) ,
905
941
proxy: proxy,
906
942
ignoreUncleanSSLShutdown: ignoreUncleanSSLShutdown,
907
- decompression: decompression
943
+ decompression: decompression,
944
+ http1_1ConnectionDebugInitializer: http1_1ConnectionDebugInitializer,
945
+ http2ConnectionDebugInitializer: http2ConnectionDebugInitializer,
946
+ http2StreamChannelDebugInitializer: http2StreamChannelDebugInitializer
908
947
)
909
948
}
910
949
@@ -916,7 +955,13 @@ public class HTTPClient {
916
955
proxy: Proxy ? = nil ,
917
956
ignoreUncleanSSLShutdown: Bool = false ,
918
957
decompression: Decompression = . disabled,
919
- backgroundActivityLogger: Logger ?
958
+ backgroundActivityLogger: Logger ? ,
959
+ http1_1ConnectionDebugInitializer:
960
+ ( @Sendable ( Channel ) -> EventLoopFuture < Void > ) ? = nil ,
961
+ http2ConnectionDebugInitializer:
962
+ ( @Sendable ( Channel ) -> EventLoopFuture < Void > ) ? = nil ,
963
+ http2StreamChannelDebugInitializer:
964
+ ( @Sendable ( Channel ) -> EventLoopFuture < Void > ) ? = nil
920
965
) {
921
966
var tlsConfig = TLSConfiguration . makeClientConfiguration ( )
922
967
tlsConfig. certificateVerification = certificateVerification
@@ -927,7 +972,10 @@ public class HTTPClient {
927
972
connectionPool: ConnectionPool ( idleTimeout: connectionPool) ,
928
973
proxy: proxy,
929
974
ignoreUncleanSSLShutdown: ignoreUncleanSSLShutdown,
930
- decompression: decompression
975
+ decompression: decompression,
976
+ http1_1ConnectionDebugInitializer: http1_1ConnectionDebugInitializer,
977
+ http2ConnectionDebugInitializer: http2ConnectionDebugInitializer,
978
+ http2StreamChannelDebugInitializer: http2StreamChannelDebugInitializer
931
979
)
932
980
}
933
981
@@ -937,7 +985,13 @@ public class HTTPClient {
937
985
timeout: Timeout = Timeout ( ) ,
938
986
proxy: Proxy ? = nil ,
939
987
ignoreUncleanSSLShutdown: Bool = false ,
940
- decompression: Decompression = . disabled
988
+ decompression: Decompression = . disabled,
989
+ http1_1ConnectionDebugInitializer:
990
+ ( @Sendable ( Channel ) -> EventLoopFuture < Void > ) ? = nil ,
991
+ http2ConnectionDebugInitializer:
992
+ ( @Sendable ( Channel ) -> EventLoopFuture < Void > ) ? = nil ,
993
+ http2StreamChannelDebugInitializer:
994
+ ( @Sendable ( Channel ) -> EventLoopFuture < Void > ) ? = nil
941
995
) {
942
996
self . init (
943
997
certificateVerification: certificateVerification,
@@ -946,7 +1000,10 @@ public class HTTPClient {
946
1000
maximumAllowedIdleTimeInConnectionPool: . seconds( 60 ) ,
947
1001
proxy: proxy,
948
1002
ignoreUncleanSSLShutdown: ignoreUncleanSSLShutdown,
949
- decompression: decompression
1003
+ decompression: decompression,
1004
+ http1_1ConnectionDebugInitializer: http1_1ConnectionDebugInitializer,
1005
+ http2ConnectionDebugInitializer: http2ConnectionDebugInitializer,
1006
+ http2StreamChannelDebugInitializer: http2StreamChannelDebugInitializer
950
1007
)
951
1008
}
952
1009
}
0 commit comments