Properly handle authentication for 302 redirect URLs (#12920)

uv was failing to authenticate on 302 redirects when credentials were
available. This was because it was relying on `reqwest_middleware`'s
default redirect behavior which bypasses the middleware pipeline when
trying the redirect request (and hence bypasses our authentication
middleware). This PR updates uv to retrigger the middleware pipeline
when handling a 302 redirect, correctly using credentials from the URL,
the keyring, or `.netrc`.

Closes #5595
Closes #11097
This commit is contained in:
John Mumm
2025-04-18 14:56:17 +02:00
committed by GitHub
parent 256b100a9e
commit 17ed789edb
11 changed files with 626 additions and 79 deletions
+2 -2
View File
@@ -52,7 +52,7 @@ impl GitResolver {
pub async fn github_fast_path(
&self,
url: &GitUrl,
client: ClientWithMiddleware,
client: &ClientWithMiddleware,
) -> Result<Option<GitOid>, GitResolverError> {
let reference = RepositoryReference::from(url);
@@ -112,7 +112,7 @@ impl GitResolver {
pub async fn fetch(
&self,
url: &GitUrl,
client: ClientWithMiddleware,
client: impl Into<ClientWithMiddleware>,
disable_ssl: bool,
offline: bool,
cache: PathBuf,