@@ -200,28 +200,52 @@ pub trait ResolveServerName {
200200 ) -> Result < ServerName < ' static > , Box < dyn std:: error:: Error + Sync + Send > > ;
201201}
202202
203- #[ cfg( test) ]
203+ #[ cfg( all(
204+ test,
205+ any( feature = "ring" , feature = "aws-lc-rs" ) ,
206+ any(
207+ feature = "rustls-native-certs" ,
208+ feature = "webpki-roots" ,
209+ feature = "rustls-platform-verifier" ,
210+ )
211+ ) ) ]
204212mod tests {
205213 use http:: Uri ;
206214 use hyper_util:: client:: legacy:: connect:: HttpConnector ;
207215 use tower:: ServiceExt ;
208216
209217 use super :: HttpsConnector ;
210- use crate :: HttpsConnectorBuilder ;
218+ use crate :: { ConfigBuilderExt , HttpsConnectorBuilder } ;
211219
212- fn https_or_http_connector ( ) -> HttpsConnector < HttpConnector > {
213- HttpsConnectorBuilder :: new ( )
220+ fn tls_config ( ) -> rustls:: ClientConfig {
221+ #[ cfg( feature = "rustls-native-certs" ) ]
222+ return rustls:: ClientConfig :: builder ( )
214223 . with_native_roots ( )
215224 . unwrap ( )
225+ . with_no_client_auth ( ) ;
226+
227+ #[ cfg( feature = "webpki-roots" ) ]
228+ return rustls:: ClientConfig :: builder ( )
229+ . with_webpki_roots ( )
230+ . with_no_client_auth ( ) ;
231+
232+ #[ cfg( feature = "rustls-platform-verifier" ) ]
233+ return rustls:: ClientConfig :: builder ( )
234+ . with_platform_verifier ( )
235+ . with_no_client_auth ( ) ;
236+ }
237+
238+ fn https_or_http_connector ( ) -> HttpsConnector < HttpConnector > {
239+ HttpsConnectorBuilder :: new ( )
240+ . with_tls_config ( tls_config ( ) )
216241 . https_or_http ( )
217242 . enable_http1 ( )
218243 . build ( )
219244 }
220245
221246 fn https_only_connector ( ) -> HttpsConnector < HttpConnector > {
222247 HttpsConnectorBuilder :: new ( )
223- . with_native_roots ( )
224- . unwrap ( )
248+ . with_tls_config ( tls_config ( ) )
225249 . https_only ( )
226250 . enable_http1 ( )
227251 . build ( )
0 commit comments