AsyncClient: The use_sys_proxy setting is deprecated upstream.
parent
88bfe1bec6
commit
d281efb309
|
@ -52,7 +52,6 @@ pub struct AsyncClient {
|
||||||
#[derive(Default, Debug)]
|
#[derive(Default, Debug)]
|
||||||
pub struct AsyncClientConfig {
|
pub struct AsyncClientConfig {
|
||||||
proxy: Option<reqwest::Proxy>,
|
proxy: Option<reqwest::Proxy>,
|
||||||
use_sys_proxy: bool,
|
|
||||||
user_agent: Option<HeaderValue>,
|
user_agent: Option<HeaderValue>,
|
||||||
disable_ssl_verification: bool,
|
disable_ssl_verification: bool,
|
||||||
}
|
}
|
||||||
|
@ -63,25 +62,10 @@ impl AsyncClientConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn proxy(mut self, proxy: &str) -> Result<Self, Error> {
|
pub fn proxy(mut self, proxy: &str) -> Result<Self, Error> {
|
||||||
if self.use_sys_proxy {
|
|
||||||
return Err(Error(InnerError::ConfigurationError(
|
|
||||||
"Using the system proxy has been previously configured.".to_string(),
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
self.proxy = Some(reqwest::Proxy::all(proxy)?);
|
self.proxy = Some(reqwest::Proxy::all(proxy)?);
|
||||||
Ok(self)
|
Ok(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn use_sys_proxy(mut self) -> Result<Self, Error> {
|
|
||||||
if self.proxy.is_some() {
|
|
||||||
return Err(Error(InnerError::ConfigurationError(
|
|
||||||
"A proxy has already been configured.".to_string(),
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
self.use_sys_proxy = true;
|
|
||||||
Ok(self)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn disable_ssl_verification(mut self) -> Self {
|
pub fn disable_ssl_verification(mut self) -> Self {
|
||||||
self.disable_ssl_verification = true;
|
self.disable_ssl_verification = true;
|
||||||
self
|
self
|
||||||
|
@ -162,12 +146,6 @@ impl AsyncClient {
|
||||||
None => http_client,
|
None => http_client,
|
||||||
};
|
};
|
||||||
|
|
||||||
let http_client = if config.use_sys_proxy {
|
|
||||||
http_client.use_sys_proxy()
|
|
||||||
} else {
|
|
||||||
http_client
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut headers = reqwest::header::HeaderMap::new();
|
let mut headers = reqwest::header::HeaderMap::new();
|
||||||
|
|
||||||
let user_agent = match config.user_agent {
|
let user_agent = match config.user_agent {
|
||||||
|
|
Loading…
Reference in New Issue