Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retain authentication attached to URLs when making requests to the same host #1874

Merged
merged 6 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Simpler yet
  • Loading branch information
zanieb committed Feb 22, 2024
commit c2ca612b147bdf37f3687b3ab2a60cee25cb77d6
12 changes: 3 additions & 9 deletions crates/uv-client/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,9 @@ fn should_retain_auth(request_url: &Url, response_url: &Url) -> bool {

// Check the port.
// The port is only allowed to differ if it it matches the "default port" for the scheme.
let default_port = match request_url.scheme() {
"http" => Some(80),
"https" => Some(443),
_ => None,
};
if request_url.port() != response_url.port()
&& request_url.port() != default_port
&& response_url.port() != default_port
{
// However, `reqwest` sets the `port` to `None` if it matches the default port so we do
// not need any special handling here.
if request_url.port() != response_url.port() {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion crates/uv-client/src/registry_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ pub enum Connectivity {
mod tests {
use std::str::FromStr;

use url::{Url};
use url::Url;

use pypi_types::{JoinRelativeError, SimpleJson};
use uv_normalize::PackageName;
Expand Down