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

Use service as hostname fallback to enable keyring usage on redirects #29

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

miguelnmiranda
Copy link

@miguelnmiranda miguelnmiranda commented Jun 30, 2022

Description

When following redirects that don't point to one of the configured indexes pip will request credentials from the keyrings using the netloc taken from the target's location url (ref).

The present implementation relies on urlib.urlparse to determine hostname (which is part of netloc). urlparse requires urls to have a schema (or at least //) in order to detect a netloc (ref), which makes it misclassify a previously parsed netloc as a path (ref).

I proposed falling back to using the service as is when a hostname cannot be found (ex. when service is just a url's netloc).

Motivation

Using a private pypi server that redirects to a GCP Artifact Registry Python repository for certain dependencies.

@google-cla
Copy link

google-cla bot commented Jun 30, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@miguelnmiranda
Copy link
Author

miguelnmiranda commented Sep 3, 2022

@megan-kuo Hi Megan, could you have a look at this PR please?

@megan-kuo
Copy link
Contributor

Thanks @miguelnmiranda! so sorry its taken me this long to respond, I'm OOO this week but will most definitely get to it next week - just wanted to drop by to say this item is on my to do list.

Thanks again!

@miguelnmiranda
Copy link
Author

@megan-kuo Hi Megan, Please provide guidance on how to move this forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants