Skip to content

Commit

Permalink
Keep compatibility with existing build functions
Browse files Browse the repository at this point in the history
These functions implicitly enabled certificate transparency,
keep that as well.
  • Loading branch information
g2p committed Feb 11, 2021
1 parent 7f0d32b commit a692d23
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,30 @@ pub struct HttpsConnector<T> {
tls_config: Arc<ClientConfig>,
}

#[cfg(all(
any(feature = "rustls-native-certs", feature = "webpki-roots"),
feature = "tokio-runtime"
))]
impl HttpsConnector<HttpConnector> {
/// Construct a new `HttpsConnector` using the OS root store
#[cfg(feature = "rustls-native-certs")]
#[cfg_attr(docsrs, doc(cfg(feature = "rustls-native-certs")))]
pub fn with_native_roots() -> Self {
HttpsConnectorBuilder::with_native_roots()
.enable_cert_transparency()
.build()
}

/// Construct a new `HttpsConnector` using the `webpki_roots`
#[cfg(feature = "webpki-roots")]
#[cfg_attr(docsrs, doc(cfg(feature = "webpki-roots")))]
pub fn with_webpki_roots() -> Self {
HttpsConnectorBuilder::with_webpki_roots()
.enable_cert_transparency()
.build()
}
}

/// A builder that will configure an `HttpsConnector`
///
/// This builder ensures configuration is consistent.
Expand Down

0 comments on commit a692d23

Please sign in to comment.