* [pve-devel] [PATCH v2 proxmox-openid-rs] add http proxy support
@ 2022-03-22 9:41 Mira Limbeck
2022-03-22 10:29 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Mira Limbeck @ 2022-03-22 9:41 UTC (permalink / raw)
To: pve-devel
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>
---
v2:
- changed from multiple branches to 'or_else' as the body was the same
in both cases
src/http_client.rs | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/http_client.rs b/src/http_client.rs
index 5cceafb..9f9e986 100644
--- a/src/http_client.rs
+++ b/src/http_client.rs
@@ -40,9 +40,15 @@ pub enum Error {
}
fn ureq_agent() -> Result<ureq::Agent, Error> {
- Ok(ureq::AgentBuilder::new()
- .tls_connector(Arc::new(native_tls::TlsConnector::new()?))
- .build())
+ let mut agent =
+ ureq::AgentBuilder::new().tls_connector(Arc::new(native_tls::TlsConnector::new()?));
+ 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())
}
///
--
2.30.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pve-devel] applied: [PATCH v2 proxmox-openid-rs] add http proxy support
2022-03-22 9:41 [pve-devel] [PATCH v2 proxmox-openid-rs] add http proxy support Mira Limbeck
@ 2022-03-22 10:29 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2022-03-22 10:29 UTC (permalink / raw)
To: Proxmox VE development discussion, Mira Limbeck
On 22.03.22 10:41, Mira Limbeck wrote:
> 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>
> ---
> v2:
> - changed from multiple branches to 'or_else' as the body was the same
> in both cases
>
> src/http_client.rs | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
>
applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-22 10:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-22 9:41 [pve-devel] [PATCH v2 proxmox-openid-rs] add http proxy support Mira Limbeck
2022-03-22 10:29 ` [pve-devel] applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox