mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00

Allow '*' as a value to match all hosts, and provide `reqwest_blocking_get` for uv tests, so that they also respect UV_INSECURE_HOST (since they respect `ALL_PROXY`). This lets those tests pass with a forward proxy - we can think about setting a root certificate later so that we don't need to disable certificate verification at all. --- I tested this locally by running: ```bash GIT_SSL_NO_VERIFY=true ALL_PROXY=localhost:8080 UV_INSECURE_HOST="*" cargo nextest run sync_wheel_path_source_error ``` With my forward proxy showing: ``` 2024-10-09T18:20:16.300188Z INFO fopro: Proxied GETcc2fedbd88/cffi-1.17.1-cp310-cp310-macosx_11_0_arm64.whl
(headers 480.024958ms + body 92.345666ms) 2024-10-09T18:20:16.913298Z INFO fopro: Proxied GET https://pypi.org/simple/pycparser/ (headers 509.664834ms + body 269.291µs) 2024-10-09T18:20:17.383975Z INFO fopro: Proxied GET5f610ebe42/pycparser-2.21-py2.py3-none-any.whl.metadata
(headers 443.184208ms + body 2.094792ms) ```
45 lines
1.1 KiB
Rust
45 lines
1.1 KiB
Rust
#[test]
|
|
fn parse() {
|
|
assert_eq!(
|
|
"*".parse::<super::TrustedHost>().unwrap(),
|
|
super::TrustedHost::Wildcard
|
|
);
|
|
|
|
assert_eq!(
|
|
"example.com".parse::<super::TrustedHost>().unwrap(),
|
|
super::TrustedHost::Host {
|
|
scheme: None,
|
|
host: "example.com".to_string(),
|
|
port: None
|
|
}
|
|
);
|
|
|
|
assert_eq!(
|
|
"example.com:8080".parse::<super::TrustedHost>().unwrap(),
|
|
super::TrustedHost::Host {
|
|
scheme: None,
|
|
host: "example.com".to_string(),
|
|
port: Some(8080)
|
|
}
|
|
);
|
|
|
|
assert_eq!(
|
|
"https://example.com".parse::<super::TrustedHost>().unwrap(),
|
|
super::TrustedHost::Host {
|
|
scheme: Some("https".to_string()),
|
|
host: "example.com".to_string(),
|
|
port: None
|
|
}
|
|
);
|
|
|
|
assert_eq!(
|
|
"https://example.com/hello/world"
|
|
.parse::<super::TrustedHost>()
|
|
.unwrap(),
|
|
super::TrustedHost::Host {
|
|
scheme: Some("https".to_string()),
|
|
host: "example.com".to_string(),
|
|
port: None
|
|
}
|
|
);
|
|
}
|