Skip to content

Commit

Permalink
fix: read proxy when downloading resources
Browse files Browse the repository at this point in the history
Port of tauri-apps/tauri#8012

Co-authored-by: Caijinglong <[email protected]>
  • Loading branch information
amr-crabnebula and CaiJingLong committed Oct 18, 2023
1 parent 8a96867 commit 6c6b8db
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changes/http_proxy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"cargo-packager": patch
---

Read `HTTP_PROXY` env var when downloading resources.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion crates/packager/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ pub fn target_triple() -> crate::Result<String> {

pub(crate) fn download(url: &str) -> crate::Result<Vec<u8>> {
tracing::info!("Downloading {}", url);
let response = ureq::get(url).call().map_err(Box::new)?;
let agent = ureq::AgentBuilder::new().try_proxy_from_env(true).build();
let response = agent.get(url).call().map_err(Box::new)?;
let mut bytes = Vec::new();
response.into_reader().read_to_end(&mut bytes)?;
Ok(bytes)
Expand Down

0 comments on commit 6c6b8db

Please sign in to comment.