Skip to content

Commit 5c83cc7

Browse files
committed
Downloading the binaries through a proxy if either HTTPS_PROXY or HTTP_PROXY environment variable is set.
closes #48
1 parent 4c3af5c commit 5c83cc7

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
strategy:
7373
fail-fast: false
7474
matrix:
75-
toolchain: [ "1.41.1", "stable", "nightly" ]
75+
toolchain: [ "1.42", "stable", "nightly" ]
7676

7777
steps:
7878
- uses: actions/checkout@v2

Cargo.toml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ documentation = "https://docs.rs/bitcoind/"
99
edition = "2018"
1010

1111
[dependencies]
12-
bitcoincore-rpc = "0.16.0"
12+
bitcoincore-rpc = "0.15.0"
1313
tempfile = "3.1"
1414
log = "0.4"
1515
which = "4.2.5"
@@ -18,14 +18,12 @@ which = "4.2.5"
1818
env_logger = "0.8"
1919

2020
[build-dependencies]
21-
bitcoin_hashes = "0.11"
21+
bitcoin_hashes = "0.10"
22+
ureq = "2.1"
23+
flate2 = "1.0"
2224
tar = "0.4"
2325
zip = "0.5"
24-
25-
# allows to keep MSRV 1.41.1
26-
ureq = "1.0"
2726
filetime = "=0.2.15"
28-
flate2 = "=1.0.22"
2927

3028
[features]
3129
"23_0" = []

build.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,19 @@ fn main() {
103103
);
104104
println!("url:{}", url);
105105
let mut downloaded_bytes = Vec::new();
106-
let resp = ureq::get(&url).call();
107-
assert_eq!(resp.status(), 200, "url {} didn't return 200", url);
108106

109-
let _size = resp
107+
let http_proxy = std::env::var("HTTPS_PROXY").or_else(|_| std::env::var("HTTP_PROXY"));
108+
let agent = if let Ok(proxy) = http_proxy {
109+
let proxy = ureq::Proxy::new(proxy).unwrap();
110+
ureq::AgentBuilder::new().proxy(proxy).build()
111+
} else {
112+
ureq::AgentBuilder::new().build()
113+
};
114+
115+
let _size = agent
116+
.get(&url)
117+
.call()
118+
.unwrap()
110119
.into_reader()
111120
.read_to_end(&mut downloaded_bytes)
112121
.unwrap();

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ mod test {
642642

643643
// bob wallet may not be immediately updated
644644
for _ in 0..30 {
645-
if bob.get_balances().unwrap().mine.untrusted_pending.to_sat() > 0 {
645+
if bob.get_balances().unwrap().mine.untrusted_pending.as_sat() > 0 {
646646
break;
647647
}
648648
std::thread::sleep(std::time::Duration::from_millis(100));

0 commit comments

Comments
 (0)