Fallback to direct download when direct URL streaming is unsupported (#18688)

## Summary

Closes https://github.com/astral-sh/uv/issues/18620.
This commit is contained in:
Charlie Marsh
2026-03-24 07:57:29 -04:00
committed by GitHub
parent 5ad8577ff8
commit cde48c8ac8
@@ -248,8 +248,8 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
return Err(Error::Extract(name, err));
}
// If the request failed because streaming is unsupported, download the
// wheel directly.
// If the request failed because streaming was unsupported or failed,
// download the wheel directly.
let archive = self
.download_wheel(
url,
@@ -314,13 +314,19 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
cache: CacheInfo::default(),
build: None,
}),
Err(Error::Client(err)) if err.is_http_streaming_unsupported() => {
warn!(
"Streaming unsupported for {dist}; downloading wheel to disk ({err})"
);
Err(Error::Extract(name, err)) => {
if err.is_http_streaming_unsupported() {
warn!(
"Streaming unsupported for {dist}; downloading wheel to disk ({err})"
);
} else if err.is_http_streaming_failed() {
warn!("Streaming failed for {dist}; downloading wheel to disk ({err})");
} else {
return Err(Error::Extract(name, err));
}
// If the request failed because streaming is unsupported, download the
// wheel directly.
// If the request failed because streaming was unsupported or failed,
// download the wheel directly.
let archive = self
.download_wheel(
wheel.url.raw().clone(),