-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
fix: revert the handling of 403 and 404 #75
Conversation
Signed-off-by: Frost Ming <[email protected]>
Signed-off-by: Frost Ming <[email protected]>
Signed-off-by: Frost Ming <[email protected]>
Signed-off-by: Frost Ming <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like we should target behavior where:
- for any of 401, 403, 404, we attempt to get credentials from netrc (or other non-prompting methods)
- If we still don't have credentials:
- 401: prompt
- 403/404: Error
However, if I understand this PR correctly, it looks like it doesn't do this. Instead:
- it immediately errors out on 403/404 - no attempt to read netrc
- Even for 401, we won't check netrc.
EDIT:
I totally missed that you're using the netrc for the initial request. I think this is a good solution. Ignore my comment above
I would only suggest that we add Line 238 in d2dd7cf
That way we are not only relying on the default value in |
Signed-off-by: Frost Ming <[email protected]>
Good point, done. |
Signed-off-by: Frost Ming [email protected]
This PR reverts some changes made by #70 but uses a different way, so that:
Before sending request to the index, the credentials in netrc will be read to authenticate the request. And only when the request fails with 401 error, the keyring will be queried and then prompt in the console.
This means if your index returns 403 or even 404 on unauthorized requests, you must rely on the credentials provided via netrc. Otherwise the error response will be returned without any atttempt to load other credentials.
This behavior is also the same as pip.