Skip to content

Commit d2a1b36

Browse files
authored
Merge pull request #14 from rust-lang/pa-fix-sda-upload
Fix uploading intel SDE
2 parents 63484a5 + e5153b0 commit d2a1b36

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/downloader.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ impl Downloader {
2121
pub(crate) fn new() -> Result<Self, Error> {
2222
Ok(Self {
2323
storage: TempDir::new()?,
24-
http: Client::new(),
24+
http: Client::builder()
25+
.user_agent("https://github.com/rust-lang/ci-mirrors")
26+
.build()?,
2527
})
2628
}
2729

@@ -32,15 +34,16 @@ impl Downloader {
3234
};
3335
eprintln!("downloading {url}...");
3436

35-
let mut reader = StreamReader::new(
36-
self.http
37-
.get(url.clone())
38-
.send()
39-
.await?
40-
.error_for_status()?
41-
.bytes_stream()
42-
.map_err(std::io::Error::other),
43-
);
37+
let resp = self.http.get(url.clone()).send().await?;
38+
if !resp.status().is_success() {
39+
bail!(
40+
"failed to download with status {}: {url}\n=== body ===\n{}\n============\n",
41+
resp.status(),
42+
resp.text().await?
43+
);
44+
}
45+
46+
let mut reader = StreamReader::new(resp.bytes_stream().map_err(std::io::Error::other));
4447

4548
let dest = File::create(self.path_for(file)).await?;
4649
let mut writer = Sha256Writer::new(BufWriter::new(dest));

0 commit comments

Comments
 (0)