Skip to content

Commit ffe0b31

Browse files
committed
Use curl instead of reqwest
1 parent cc755e3 commit ffe0b31

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ exclude = ["mkl_lib/mkl.tar.xz"]
1818
[build-dependencies]
1919
pkg-config = "0.3"
2020
failure = "0.1"
21-
reqwest = "0.9"
2221
xz2 = "0.1"
2322
tar = "0.4"
23+
curl = "0.4"
2424

2525
[dev-dependencies]
2626
libc = "0.2"

build.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
// SOFTWARE.
2222

23+
use curl::easy::Easy;
2324
use failure::*;
24-
use std::{env, fs, io, path::*};
25+
use std::{
26+
env, fs,
27+
io::{self, Write},
28+
path::*,
29+
};
2530

2631
const S3_ADDR: &'static str = "https://s3-ap-northeast-1.amazonaws.com/rust-intel-mkl";
2732

@@ -57,13 +62,12 @@ fn main() -> Fallible<()> {
5762
let archive = out_dir.join(mkl::ARCHIVE);
5863
if !archive.exists() {
5964
eprintln!("Download archive from AWS S3: {}/{}", S3_ADDR, mkl::ARCHIVE);
60-
let mut res = reqwest::get(&format!("{}/{}", S3_ADDR, mkl::ARCHIVE))?;
61-
if !res.status().is_success() {
62-
bail!("HTTP access failed: {}", res.status());
63-
}
6465
let f = fs::File::create(&archive)?;
6566
let mut buf = io::BufWriter::new(f);
66-
res.copy_to(&mut buf)?;
67+
let mut easy = Easy::new();
68+
easy.url(&format!("{}/{}", S3_ADDR, mkl::ARCHIVE))?;
69+
easy.write_function(move |data| Ok(buf.write(data).unwrap()))?;
70+
easy.perform()?;
6771
assert!(archive.exists());
6872
} else {
6973
eprintln!("Use existing archive");

0 commit comments

Comments
 (0)