mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-23 04:55:28 +00:00
Fallback to non-range requests when HEAD returns 404 (#2186)
## Summary We have at least one reported case of this happening. It's preferable IMO to move on rather than fail hard despite sub-pbar registry behavior. Closes https://github.com/astral-sh/uv/issues/2099.
This commit is contained in:
parent
60a78812f9
commit
93b1395daa
1 changed files with 9 additions and 0 deletions
|
|
@ -170,9 +170,18 @@ impl ErrorKind {
|
|||
// HEAD requests, so we can't check for range requests.
|
||||
Self::ReqwestError(err) => {
|
||||
if let Some(status) = err.status() {
|
||||
// If the server doesn't support HEAD requests, we can't check for range
|
||||
// requests.
|
||||
if status == reqwest::StatusCode::METHOD_NOT_ALLOWED {
|
||||
return true;
|
||||
}
|
||||
|
||||
// In some cases, registries return a 404 for HEAD requests when they're not
|
||||
// supported. In the worst case, we'll now just proceed to attempt to stream the
|
||||
// entire file, so it's fine to be somewhat lenient here.
|
||||
if status == reqwest::StatusCode::NOT_FOUND {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue