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

Fix infinite loop on wrong Digest Authentication #547

Merged
merged 2 commits into from Apr 13, 2012
Merged

Fix infinite loop on wrong Digest Authentication #547

merged 2 commits into from Apr 13, 2012

Conversation

catwell
Copy link
Contributor

@catwell catwell commented Apr 12, 2012

The most straightforward way to fix #541 seems to be to deregister the hook on the first 401. This is what I have implemented here.

@catwell
Copy link
Contributor Author

catwell commented Apr 12, 2012

Hmm, the second commit is something different (I should have created a branch).
It fixes the conflict between Digest Auth and Multipart Post (#298).

I am less convinced that my implementation is the right way to do it there, so take it as a suggestion (and motivation to fix a 4 months old bug hit by one of our clients :p).

@kennethreitz
Copy link
Contributor

This is fantastic. Thanks!

🍰

@kennethreitz kennethreitz merged commit f3ad56f into psf:develop Apr 13, 2012
vickimo pushed a commit to vickimo/requests that referenced this pull request Jul 14, 2012
Modified code to use the current fix versus the old fix, which was broken.

Co-Authored By: Timnit Gebru <tgebru@gmail.com>
Co-Authored By: Sarah Gonzalez <smar.gonz@gmail.com>
Co-Authored By: Leila Muhtasib <muhtasib@gmail.com>
kennethreitz pushed a commit that referenced this pull request Jul 14, 2012
Fix infinite loop on wrong Digest Authentication (Issue #541 and #547)
exvito added a commit to exvito/requests that referenced this pull request Apr 2, 2015
The existing code counts the number of 401 responses in the num_401_calls
authenticator attribute. This is in place so as to ensure the necessary auth
header is sent, while avoiding infinite 401 loops (issue psf#547).

This commit makes num_401_calls an instance of threading.local() (previously
an integer), using num_401_calls.value as the counter.

It ensures that concurrent authentication requests get each their own counter
and behave as expected (otherwise every other concurrent request would have
its authentication fail).
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants