Skip to content

Commit

Permalink
Merge pull request psf#727 from vickimo/issue_547
Browse files Browse the repository at this point in the history
Fix infinite loop on wrong Digest Authentication (Issue psf#541 and psf#547)
  • Loading branch information
Kenneth Reitz committed Jul 14, 2012
2 parents a97a513 + 5296b8b commit 73815e2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions requests/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ def __init__(self, username, password):
def handle_401(self, r):
"""Takes the given response and tries digest-auth, if needed."""

r.request.deregister_hook('response', self.handle_401)

num_401_calls = r.request.hooks['response'].count(self.handle_401)
s_auth = r.headers.get('www-authenticate', '')

if 'digest' in s_auth.lower():
if 'digest' in s_auth.lower() and num_401_calls < 2:

last_nonce = ''
nonce_count = 0
Expand Down

0 comments on commit 73815e2

Please sign in to comment.