Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove feature __internal_proxy_sys_no_cache #2442

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,12 @@ jobs:

include:
- name: linux / stable
test-features: "--features __internal_proxy_sys_no_cache"
- name: linux / beta
rust: beta
test-features: "--features __internal_proxy_sys_no_cache"
# - name: linux / nightly
# rust: nightly
# test-features: "--features __internal_proxy_sys_no_cache"
- name: macOS / stable
os: macOS-latest
test-features: "--features __internal_proxy_sys_no_cache"

- name: windows / stable-x86_64-msvc
os: windows-latest
Expand Down Expand Up @@ -272,7 +268,7 @@ jobs:
run: |
cargo clean
cargo update -Z minimal-versions
cargo update -p proc-macro2 --precise 1.0.62
cargo update -p proc-macro2 --precise 1.0.87
cargo check
cargo check --all-features

Expand Down
14 changes: 3 additions & 11 deletions src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::into_url::{IntoUrl, IntoUrlSealed};
use crate::Url;
use http::{header::HeaderValue, Uri};
use ipnet::IpNet;
use once_cell::sync::Lazy;
use percent_encoding::percent_decode;
use std::collections::HashMap;
use std::env;
Expand Down Expand Up @@ -280,13 +279,9 @@ impl Proxy {
}

pub(crate) fn system() -> Proxy {
let mut proxy = if cfg!(feature = "__internal_proxy_sys_no_cache") {
Proxy::new(Intercept::System(Arc::new(get_sys_proxies(
get_from_platform(),
))))
} else {
Proxy::new(Intercept::System(SYS_PROXIES.clone()))
};
let mut proxy = Proxy::new(Intercept::System(Arc::new(get_sys_proxies(
get_from_platform(),
))));
proxy.no_proxy = NoProxy::from_env();
proxy
}
Expand Down Expand Up @@ -876,9 +871,6 @@ impl Dst for Uri {
}
}

static SYS_PROXIES: Lazy<Arc<SystemProxyMap>> =
Lazy::new(|| Arc::new(get_sys_proxies(get_from_platform())));

/// Get system proxies information.
///
/// All platforms will check for proxy settings via environment variables.
Expand Down
4 changes: 0 additions & 4 deletions tests/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ async fn test_no_proxy() {
assert_eq!(res.status(), reqwest::StatusCode::OK);
}

#[cfg_attr(not(feature = "__internal_proxy_sys_no_cache"), ignore)]
#[tokio::test]
async fn test_using_system_proxy() {
let url = "http://not.a.real.sub.hyper.rs/prox";
Expand All @@ -175,9 +174,6 @@ async fn test_using_system_proxy() {
async { http::Response::default() }
});

// Note: we're relying on the `__internal_proxy_sys_no_cache` feature to
// check the environment every time.

// save system setting first.
let system_proxy = env::var("http_proxy");
// set-up http proxy.
Expand Down