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

add proxy support to the package download subcommand #4640

Merged
merged 4 commits into from
May 9, 2024
Merged
Changes from 1 commit
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
12 changes: 11 additions & 1 deletion lib/cli/src/commands/package/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,17 @@ impl PackageDownload {
PackageSource::Url(url) => bail!("cannot download a package from a URL: '{}'", url),
};

let client = reqwest::blocking::Client::new();
let client = {
let mut builder = reqwest::blocking::ClientBuilder::new();

let proxy = std::env::var("http_proxy").or_else(|_| std::env::var("HTTP_PROXY"));
if let Ok(scheme) = proxy {
builder = builder.proxy(reqwest::Proxy::all(scheme)?);
}

builder.build().context("Could not create reqwest client")?
};
maminrayej marked this conversation as resolved.
Show resolved Hide resolved

let mut b = client
.get(download_url)
.header(http::header::ACCEPT, "application/webc");
Expand Down
Loading