Skip to content

Commit cde48c8

Browse files
Fallback to direct download when direct URL streaming is unsupported (#18688)
## Summary Closes #18620.
1 parent 5ad8577 commit cde48c8

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

crates/uv-distribution/src/distribution_database.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
248248
return Err(Error::Extract(name, err));
249249
}
250250

251-
// If the request failed because streaming is unsupported, download the
252-
// wheel directly.
251+
// If the request failed because streaming was unsupported or failed,
252+
// download the wheel directly.
253253
let archive = self
254254
.download_wheel(
255255
url,
@@ -314,13 +314,19 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
314314
cache: CacheInfo::default(),
315315
build: None,
316316
}),
317-
Err(Error::Client(err)) if err.is_http_streaming_unsupported() => {
318-
warn!(
319-
"Streaming unsupported for {dist}; downloading wheel to disk ({err})"
320-
);
317+
Err(Error::Extract(name, err)) => {
318+
if err.is_http_streaming_unsupported() {
319+
warn!(
320+
"Streaming unsupported for {dist}; downloading wheel to disk ({err})"
321+
);
322+
} else if err.is_http_streaming_failed() {
323+
warn!("Streaming failed for {dist}; downloading wheel to disk ({err})");
324+
} else {
325+
return Err(Error::Extract(name, err));
326+
}
321327

322-
// If the request failed because streaming is unsupported, download the
323-
// wheel directly.
328+
// If the request failed because streaming was unsupported or failed,
329+
// download the wheel directly.
324330
let archive = self
325331
.download_wheel(
326332
wheel.url.raw().clone(),

0 commit comments

Comments
 (0)