mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Add in-URL credentials to store prior to creating requests (#2446)
## Summary The authentication middleware extracts in-URL credentials from URLs that pass through it; however, by the time a request reaches the store, the credentials will have already been removed, and relocated to the header. So we were never propagating in-URL credentials. This PR adds an explicit pass wherein we pass in-URL credentials to the store prior to doing any work. Closes https://github.com/astral-sh/uv/issues/2444. ## Test Plan `cargo run pip install` against an authenticated AWS registry.
This commit is contained in:
parent
d29645ce75
commit
f1aec3e779
9 changed files with 53 additions and 22 deletions
|
@ -57,21 +57,6 @@ pub struct BaseUrl(
|
|||
);
|
||||
|
||||
impl BaseUrl {
|
||||
/// Parse the given URL. If it's relative, join it to the current [`BaseUrl`]. Allows for
|
||||
/// parsing URLs that may be absolute or relative, with a known base URL.
|
||||
pub fn join_relative(&self, url: &str) -> Result<Url, url::ParseError> {
|
||||
match Url::parse(url) {
|
||||
Ok(url) => Ok(url),
|
||||
Err(err) => {
|
||||
if err == url::ParseError::RelativeUrlWithoutBase {
|
||||
self.0.join(url)
|
||||
} else {
|
||||
Err(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Return the underlying [`Url`].
|
||||
pub fn as_url(&self) -> &Url {
|
||||
&self.0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue