Requests using proxy settings from ENV

master
jjy 7 months ago
parent 62ab39cf82
commit eaf32bbd12
  1. 12
      Cargo.lock
  2. 2
      Cargo.toml
  3. 5
      src/install/krate.rs
  4. 1
      src/manifest/mod.rs
  5. 7
      src/test/webdriver/chromedriver.rs
  6. 6
      src/test/webdriver/geckodriver.rs

12
Cargo.lock generated

@ -1452,6 +1452,17 @@ version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "socks"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0c3dbbd9ae980613c6dd8e28a9407b50509d3803b57624d5dfe8315218cd58b"
dependencies = [
"byteorder",
"libc",
"winapi",
]
[[package]]
name = "spin"
version = "0.9.8"
@ -1682,6 +1693,7 @@ dependencies = [
"rustls-webpki",
"serde",
"serde_json",
"socks",
"url",
"webpki-roots",
]

@ -32,7 +32,7 @@ siphasher = "0.3.10"
strsim = "0.10.0"
clap = { version = "4.2.5", features = ["derive"] }
toml = "0.7.3"
ureq = { version = "2.6.2", features = ["json"] }
ureq = { version = "2.6.2", features = ["json", "socks-proxy"] }
walkdir = "2.3.2"
which = "4.4.0"
path-clean = "1.0.1"

@ -17,7 +17,10 @@ pub struct KrateResponse {
impl Krate {
pub fn new(name: &Tool) -> Result<Krate> {
let krate_address = format!("https://crates.io/api/v1/crates/{}", name);
let res = ureq::get(&krate_address)
let res = ureq::builder()
.try_proxy_from_env(true)
.build()
.get(&krate_address)
.set(
"user-agent",
&format!("wasm-pack/{}", VERSION.unwrap_or("unknown")),

@ -227,6 +227,7 @@ impl Crate {
fn check_wasm_pack_latest_version() -> Result<Crate> {
let url = "https://crates.io/api/v1/crates/wasm-pack";
let agent = ureq::builder()
.try_proxy_from_env(true)
.user_agent(&format!(
"wasm-pack/{} ({})",
WASM_PACK_VERSION.unwrap_or_else(|| "unknown"),

@ -134,9 +134,10 @@ struct GoodLatestVersions {
/// Retrieve the latest version of chromedriver from the json endpoints.
/// See: <https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints>
fn fetch_chromedriver_version() -> Result<String> {
let info: GoodLatestVersions = ureq::get(
"https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json",
)
let info: GoodLatestVersions = ureq::builder()
.try_proxy_from_env(true)
.build()
.get("https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json")
.call()
.context("fetching of chromedriver's LATEST_RELEASE failed")?
.into_json()

@ -141,8 +141,10 @@ fn should_load_geckodriver_version_from_stamp(json: &serde_json::Value) -> bool
}
fn fetch_latest_geckodriver_tag_json() -> Result<String> {
let content: serde_json::Value =
ureq::get("https://github.com/mozilla/geckodriver/releases/latest")
let content: serde_json::Value = ureq::builder()
.try_proxy_from_env(true)
.build()
.get("https://github.com/mozilla/geckodriver/releases/latest")
.set("Accept", "application/json")
.call()
.context("fetching of geckodriver's latest release data failed")?

Loading…
Cancel
Save