diff --git a/rspotify-http/Cargo.toml b/rspotify-http/Cargo.toml index 8270fe2b..3c84efb4 100644 --- a/rspotify-http/Cargo.toml +++ b/rspotify-http/Cargo.toml @@ -25,7 +25,7 @@ thiserror = "1.0.29" # Supported clients reqwest = { version = "0.11.4", default-features = false, features = ["json", "socks"], optional = true } -ureq = { version = "2.2.0", default-features = false, features = ["json", "cookies"], optional = true } +ureq = { version = "2.2.0", default-features = false, features = ["json", "cookies", "socks-proxy"], optional = true } [dev-dependencies] tokio = { version = "1.11.0", features = ["macros", "rt-multi-thread"] } diff --git a/rspotify-http/src/ureq.rs b/rspotify-http/src/ureq.rs index 797b2621..6631b9e8 100644 --- a/rspotify-http/src/ureq.rs +++ b/rspotify-http/src/ureq.rs @@ -58,6 +58,7 @@ pub struct UreqClient { impl Default for UreqClient { fn default() -> Self { let agent = ureq::AgentBuilder::new() + .try_proxy_from_env(true) .timeout(Duration::from_secs(10)) .build(); Self { agent } diff --git a/src/lib.rs b/src/lib.rs index e24f1ac8..67ea075e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -50,9 +50,14 @@ //! //! ### Proxies //! -//! [reqwest supports system proxies by default][reqwest-proxies]. It reads the -//! environment variables `HTTP_PROXY` and `HTTPS_PROXY` environmental variables -//! to set HTTP and HTTPS proxies, respectively. +//! Both [reqwest][reqwest-proxies] and [ureq][ureq-proxying] support system +//! proxies by default. They both read `http_proxy`, `https_proxy`, `all_proxy` +//! and their uppercase variants `HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`, +//! although the specific logic implementations are a little different. +//! +//! See also: +//! - [reqwest](https://docs.rs/reqwest/latest/src/reqwest/proxy.rs.html#897-920) +//! - [ureq](https://docs.rs/ureq/latest/src/ureq/proxy.rs.html#73-95) //! //! ### Environmental variables //!