Skip to content

Commit ca7234a

Browse files
authored
Merge pull request #98 from lazareviczoran/add-feature-flags-for-native-tls
Use native-tls/native-certs features of ureq crate
2 parents a5fbe97 + 654537a commit ca7234a

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

openblas-build/Cargo.toml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,23 @@ name = "openblas-build"
33
version = "0.10.7"
44
license = "Apache-2.0/MIT"
55
edition = "2018"
6-
authors = [
7-
"Toshiki Teramura <toshiki.teramura@gmail.com>",
8-
]
6+
authors = ["Toshiki Teramura <toshiki.teramura@gmail.com>"]
97
description = "The package provides a build helper for OpenBLAS."
108
documentation = "https://docs.rs/openblas-build"
119
homepage = "https://github.com/blas-lapack-rs/openblas-src"
1210
repository = "https://github.com/blas-lapack-rs/openblas-src"
13-
readme = "../README.md"
14-
exclude = [
15-
"test_build/",
16-
]
11+
readme = "../README.md"
12+
exclude = ["test_build/"]
1713

1814
[dependencies]
1915
anyhow = "1.0.68"
2016
flate2 = "1.0.25"
2117
tar = "0.4.38"
2218
thiserror = "1.0.22"
23-
ureq = "2.5.0"
19+
ureq = { version = "2.5.0", default-features = false, features = [
20+
"native-certs",
21+
"native-tls",
22+
"gzip",
23+
] }
24+
native-tls = { version = "0.2.11" }
2425
walkdir = "2.3.1"

openblas-build/src/download.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,22 @@ pub fn openblas_source_url() -> String {
1313
pub fn download(out_dir: &Path) -> Result<PathBuf> {
1414
let dest = out_dir.join(format!("OpenBLAS-{}", OPENBLAS_VERSION));
1515
if !dest.exists() {
16-
let buf = ureq::get(&openblas_source_url()).call()?.into_reader();
16+
let buf = get_agent()
17+
.get(&openblas_source_url())
18+
.call()?
19+
.into_reader();
1720
let gz_stream = flate2::read::GzDecoder::new(buf);
1821
let mut ar = tar::Archive::new(gz_stream);
1922
ar.unpack(out_dir)?;
2023
assert!(dest.exists());
2124
}
2225
Ok(dest)
2326
}
27+
28+
fn get_agent() -> ureq::Agent {
29+
ureq::AgentBuilder::new()
30+
.tls_connector(std::sync::Arc::new(
31+
native_tls::TlsConnector::new().expect("failed to create TLS connector"),
32+
))
33+
.build()
34+
}

0 commit comments

Comments
 (0)