Skip to content

Commit

Permalink
fix: read proxy when downloading resources (#49)
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 cd89984 commit 274a6be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
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.
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 274a6be

Please sign in to comment.