Skip to content

Commit

Permalink
Downloading the binaries through a proxy if either HTTPS_PROXY or HTT…
Browse files Browse the repository at this point in the history
…P_PROXY environment variable is set.

closes RCasatta#29
  • Loading branch information
ulrichard committed Sep 29, 2022
1 parent 1a80de1 commit da0b2dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ license = "MIT"
edition = "2018"

[dependencies]
bitcoind = { version = "0.27.0" }
electrum-client = { version="0.12.0", default-features = false }
bitcoind = { git = "https://github.com/weareseba/bitcoind", branch = "feature/proxy" }
electrum-client = { version="0.11", default-features = false }
nix = { version="0.25.0" }
log = "0.4"

Expand Down
11 changes: 10 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,16 @@ fn main() {
let url = format!("{}/{}", GITHUB_URL, download_filename);
let mut downloaded_bytes = Vec::new();

let _size = ureq::get(&url)
let http_proxy = std::env::var("HTTPS_PROXY").or_else(|_| std::env::var("HTTP_PROXY"));
let agent = if let Ok(proxy) = http_proxy {
let proxy = ureq::Proxy::new(proxy).unwrap();
ureq::AgentBuilder::new().proxy(proxy).build()
} else {
ureq::AgentBuilder::new().build()
};

let _size = agent
.get(&url)
.call()
.unwrap()
.into_reader()
Expand Down

0 comments on commit da0b2dd

Please sign in to comment.