Skip to content

Commit a692d23

Browse files
committed
Keep compatibility with existing build functions
These functions implicitly enabled certificate transparency, keep that as well.
1 parent 7f0d32b commit a692d23

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/connector.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,30 @@ pub struct HttpsConnector<T> {
2222
tls_config: Arc<ClientConfig>,
2323
}
2424

25+
#[cfg(all(
26+
any(feature = "rustls-native-certs", feature = "webpki-roots"),
27+
feature = "tokio-runtime"
28+
))]
29+
impl HttpsConnector<HttpConnector> {
30+
/// Construct a new `HttpsConnector` using the OS root store
31+
#[cfg(feature = "rustls-native-certs")]
32+
#[cfg_attr(docsrs, doc(cfg(feature = "rustls-native-certs")))]
33+
pub fn with_native_roots() -> Self {
34+
HttpsConnectorBuilder::with_native_roots()
35+
.enable_cert_transparency()
36+
.build()
37+
}
38+
39+
/// Construct a new `HttpsConnector` using the `webpki_roots`
40+
#[cfg(feature = "webpki-roots")]
41+
#[cfg_attr(docsrs, doc(cfg(feature = "webpki-roots")))]
42+
pub fn with_webpki_roots() -> Self {
43+
HttpsConnectorBuilder::with_webpki_roots()
44+
.enable_cert_transparency()
45+
.build()
46+
}
47+
}
48+
2549
/// A builder that will configure an `HttpsConnector`
2650
///
2751
/// This builder ensures configuration is consistent.

0 commit comments

Comments
 (0)