mirror of
https://git.proxmox.com/git/proxmox
synced 2025-06-10 03:21:11 +00:00
add http proxy support
ureq has support for a HTTP proxy, but no support for HTTPS proxy yet. ureq doesn't query `all_proxy` and `ALL_PROXY` environment variables by itself, the way curl does. So set the proxy in code if any of the above environment variables are set. Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
This commit is contained in:
parent
8b15ac202e
commit
e0535e56ad
@ -40,9 +40,15 @@ pub enum Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn ureq_agent() -> Result<ureq::Agent, Error> {
|
fn ureq_agent() -> Result<ureq::Agent, Error> {
|
||||||
Ok(ureq::AgentBuilder::new()
|
let mut agent =
|
||||||
.tls_connector(Arc::new(native_tls::TlsConnector::new()?))
|
ureq::AgentBuilder::new().tls_connector(Arc::new(native_tls::TlsConnector::new()?));
|
||||||
.build())
|
if let Ok(val) = std::env::var("all_proxy").or_else(|_| std::env::var("ALL_PROXY")) {
|
||||||
|
let proxy = ureq::Proxy::new(val).map_err(Box::new)?;
|
||||||
|
agent = agent.proxy(proxy);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Ok(agent.build())
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user