1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
use hyper_tls::HttpsConnector;

use crate::{new_trust_dns_http_connector, TrustDnsHttpConnector};

/// A [`HttpsConnector`] that uses a [`TrustDnsHttpConnector`].
#[cfg_attr(docsrs, doc(cfg(feature = "native-tls")))]
pub type NativeTlsHttpsConnector = HttpsConnector<TrustDnsHttpConnector>;

/// Create a new [`NativeTlsHttpsConnector`].
#[must_use]
#[cfg_attr(docsrs, doc(cfg(feature = "native-tls")))]
pub fn new_native_tls_https_connector() -> NativeTlsHttpsConnector {
    let mut http_connector = new_trust_dns_http_connector();
    http_connector.enforce_http(false);

    NativeTlsHttpsConnector::new_with_connector(http_connector)
}