From 346e6b7e8bf92f89d2d7f5ba13d7183e76e615df Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Sat, 15 Feb 2025 22:02:46 -0600 Subject: [PATCH] Fallback to `GET` on HTTP 400 when attempting to use range requests for wheel download (#11539) See https://github.com/astral-sh/uv/issues/11501 --- crates/uv-client/src/error.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/uv-client/src/error.rs b/crates/uv-client/src/error.rs index 294091889..12b110199 100644 --- a/crates/uv-client/src/error.rs +++ b/crates/uv-client/src/error.rs @@ -98,6 +98,12 @@ impl Error { if status == reqwest::StatusCode::FORBIDDEN { return true; } + + // In some cases, registries (like Alibaba Cloud) return a 400 for HEAD requests + // when they're not supported. Again, it's better to be lenient here. + if status == reqwest::StatusCode::BAD_REQUEST { + return true; + } } }