add ability to create a client with own tls connector (#809)
This commit is contained in:
@@ -107,6 +107,31 @@ impl Connector {
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(feature = "default-tls")]
|
||||
pub(crate) fn from_built_default<T> (
|
||||
tls: TlsConnector,
|
||||
proxies: Arc<Vec<Proxy>>,
|
||||
user_agent: Option<HeaderValue>,
|
||||
local_addr: T,
|
||||
nodelay: bool) -> crate::Result<Connector>
|
||||
where
|
||||
T: Into<Option<IpAddr>>,
|
||||
{
|
||||
|
||||
let mut http = http_connector()?;
|
||||
http.set_local_address(local_addr.into());
|
||||
http.enforce_http(false);
|
||||
|
||||
Ok(Connector {
|
||||
inner: Inner::DefaultTls(http, tls),
|
||||
proxies,
|
||||
verbose: verbose::OFF,
|
||||
timeout: None,
|
||||
nodelay,
|
||||
user_agent,
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(feature = "rustls-tls")]
|
||||
pub(crate) fn new_rustls_tls<T>(
|
||||
tls: rustls::ClientConfig,
|
||||
|
||||
Reference in New Issue
Block a user