Require the native-tls feature to supply a preconfigured tls (#814)

This commit is contained in:
Sean McArthur
2020-02-21 12:41:13 -08:00
committed by GitHub
parent 9ab8ab945c
commit 2e06108f70
5 changed files with 55 additions and 27 deletions

View File

@@ -92,23 +92,17 @@ impl Connector {
T: Into<Option<IpAddr>>,
{
let tls = tls.build().map_err(crate::error::builder)?;
let mut http = http_connector()?;
http.set_local_address(local_addr.into());
http.enforce_http(false);
Ok(Connector {
inner: Inner::DefaultTls(http, tls),
Self::from_built_default_tls(
tls,
proxies,
verbose: verbose::OFF,
timeout: None,
nodelay,
user_agent,
})
local_addr,
nodelay,
)
}
#[cfg(feature = "default-tls")]
pub(crate) fn from_built_default<T> (
pub(crate) fn from_built_default_tls<T> (
tls: TlsConnector,
proxies: Arc<Vec<Proxy>>,
user_agent: Option<HeaderValue>,
@@ -117,7 +111,6 @@ impl Connector {
where
T: Into<Option<IpAddr>>,
{
let mut http = http_connector()?;
http.set_local_address(local_addr.into());
http.enforce_http(false);