Skip to content

Commit

Permalink
Merge pull request #2415 from sigmavirus24/bug/2408
Browse files Browse the repository at this point in the history
Move noncebit to the only place it is used
  • Loading branch information
kennethreitz committed Jan 27, 2015
2 parents 2f7f6a5 + 677bbe3 commit cf3a7f4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion requests/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,15 @@ def sha_utf8(x):
s += os.urandom(8)

cnonce = (hashlib.sha1(s).hexdigest()[:16])
noncebit = "%s:%s:%s:%s:%s" % (nonce, ncvalue, cnonce, qop, HA2)
if _algorithm == 'MD5-SESS':
HA1 = hash_utf8('%s:%s:%s' % (HA1, nonce, cnonce))

if qop is None:
respdig = KD(HA1, "%s:%s" % (nonce, HA2))
elif qop == 'auth' or 'auth' in qop.split(','):
noncebit = "%s:%s:%s:%s:%s" % (
nonce, ncvalue, cnonce, 'auth', HA2
)
respdig = KD(HA1, noncebit)
else:
# XXX handle auth-int.
Expand Down

0 comments on commit cf3a7f4

Please sign in to comment.