Skip to content
Myr

Handle case when WWW-Authenticate returns multiple qops

Before adoption: this commit came in with the history the project adopted, so no landing records it.

In Digest Access Authentication there are two possible values (four if you count the not-present and both cases) for authentication. We were narrowly handling one of the four cases. Now we handle two.

authored by Ian Cordasco · committed by Ian Cordasco · parent c0e9f41 · Browse files · 1 file+3 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−3 removed

  • other:+3 added−3 removed

1 file+3 added−3 removed

modified:requests/auth.py+3 added-3 removed
103 unmodified lines
104105 A1 = '%s:%s:%s' % (self.username, realm, self.password)106 A2 = '%s:%s' % (method, path)107108 if qop == 'auth':108 if qop is None:109 respdig = KD(hash_utf8(A1), "%s:%s" % (nonce, hash_utf8(A2)))110 elif qop == 'auth' or 'auth' in qop.split(','):111 if nonce == self.last_nonce:112 self.nonce_count += 1113 else:114 self.nonce_count = 1
6 unmodified lines
121122 cnonce = (hashlib.sha1(s).hexdigest()[:16])123 noncebit = "%s:%s:%s:%s:%s" % (nonce, ncvalue, cnonce, qop, hash_utf8(A2))124 respdig = KD(hash_utf8(A1), noncebit)123 elif qop is None:124 respdig = KD(hash_utf8(A1), "%s:%s" % (nonce, hash_utf8(A2)))125 else:126 # XXX handle auth-int.127 return None128
52 unmodified lines