Skip to content

Commit

Permalink
feat: support network proxy from environment
Browse files Browse the repository at this point in the history
  • Loading branch information
mokurin000 committed Nov 29, 2024
1 parent 52c12b8 commit 1dfee2b
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions crates/rust-releases-io/src/client/cached_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,13 @@ fn setup_cache_folder(manifest_path: &Path) -> Result<(), CachedClientError> {
}

fn fetch_file(url: &str) -> Result<Box<dyn Read + Send + Sync>, CachedClientError> {
let response = ureq::get(url)
.set(
"User-Agent",
"rust-releases (github.com/foresterre/rust-releases/issues)",
)
.call()
.map_err(|err| HttpError {
error: Box::new(err),
})?;
let agent = ureq::AgentBuilder::new()
.user_agent("rust-releases (github.com/foresterre/rust-releases/issues)")
.try_proxy_from_env(true)
.build();
let response = agent.get(url).call().map_err(|err| HttpError {
error: Box::new(err),
})?;

Ok(response.into_reader())
}
Expand Down

0 comments on commit 1dfee2b

Please sign in to comment.