Skip to content

Commit abdbb0e

Browse files
committed
Improve rustls feature logic
Features are additive, as downstream dependencies can always add features Adjust logic so that priority is nativetls > aws-rs-lc > ring
1 parent 5972f7e commit abdbb0e

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/lib.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,22 +93,23 @@ impl Default for Client {
9393
))]
9494
connector.enforce_http(false);
9595

96-
#[cfg(all(
97-
feature = "native-tls",
98-
not(feature = "rustls-tls"),
99-
not(feature = "rustls-tls-aws")
100-
))]
96+
#[cfg(feature = "native-tls")]
10197
let connector = hyper_tls::HttpsConnector::new_with_connector(connector);
10298

103-
#[cfg(all(feature = "rustls-tls", not(feature = "rustls-tls-aws")))]
104-
let connector =
105-
prepare_hyper_rustls_connector(connector, rustls::crypto::ring::default_provider());
106-
#[cfg(all(feature = "rustls-tls-aws", not(feature = "rustls-tls")))]
99+
#[cfg(all(feature = "rustls-tls-aws", not(feature = "native-tls")))]
107100
let connector = prepare_hyper_rustls_connector(
108101
connector,
109102
rustls::crypto::aws_lc_rs::default_provider(),
110103
);
111104

105+
#[cfg(all(
106+
feature = "rustls-tls",
107+
not(feature = "rustls-tls-aws"),
108+
not(feature = "native-tls")
109+
))]
110+
let connector =
111+
prepare_hyper_rustls_connector(connector, rustls::crypto::ring::default_provider());
112+
112113
let client = HyperClient::builder(TokioExecutor::new())
113114
.pool_idle_timeout(POOL_IDLE_TIMEOUT)
114115
.build(connector);

0 commit comments

Comments
 (0)