11use std:: sync:: Arc ;
22
33use hyper_util:: client:: legacy:: connect:: HttpConnector ;
4- #[ cfg( any( feature = "rustls-native-certs" , feature = "webpki-roots" ) ) ]
4+ #[ cfg( any(
5+ feature = "rustls-native-certs" ,
6+ feature = "rustls-platform-verifier" ,
7+ feature = "webpki-roots"
8+ ) ) ]
59use rustls:: crypto:: CryptoProvider ;
610use rustls:: ClientConfig ;
711
@@ -61,7 +65,8 @@ impl ConnectorBuilder<WantsTlsConfig> {
6165 ConnectorBuilder ( WantsSchemes { tls_config : config } )
6266 }
6367
64- /// Use rustls' default crypto provider and other defaults, and the platform verifier
68+ /// Shorthand for using rustls' default crypto provider and other defaults, and
69+ /// the platform verifier.
6570 ///
6671 /// See [`ConfigBuilderExt::with_platform_verifier()`].
6772 #[ cfg( all(
@@ -76,6 +81,23 @@ impl ConnectorBuilder<WantsTlsConfig> {
7681 )
7782 }
7883
84+ /// Shorthand for using a custom [`CryptoProvider`] and the platform verifier.
85+ ///
86+ /// See [`ConfigBuilderExt::with_platform_verifier()`].
87+ #[ cfg( feature = "rustls-platform-verifier" ) ]
88+ pub fn with_provider_and_platform_verifier (
89+ self ,
90+ provider : CryptoProvider ,
91+ ) -> std:: io:: Result < ConnectorBuilder < WantsSchemes > > {
92+ Ok ( self . with_tls_config (
93+ ClientConfig :: builder_with_provider ( provider. into ( ) )
94+ . with_safe_default_protocol_versions ( )
95+ . map_err ( |e| std:: io:: Error :: new ( std:: io:: ErrorKind :: Other , e) ) ?
96+ . with_platform_verifier ( )
97+ . with_no_client_auth ( ) ,
98+ ) )
99+ }
100+
79101 /// Shorthand for using rustls' default crypto provider and safe defaults, with
80102 /// native roots.
81103 ///
0 commit comments