Merged revisions 76288 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r76288 | senthil.kumaran | 2009-11-15 14:06:20 +0530 (Sun, 15 Nov 2009) | 3 lines

  Fix for Issue4683 - urllib2.HTTPDigestAuthHandler fails on third hostname?.
  Resolution: Reset the nonce value for each unique nonce (as per RFC 2617)
........
This commit is contained in:
Senthil Kumaran 2009-11-15 08:43:45 +00:00
parent 1107c5d7d1
commit 4c7eaee5db
1 changed files with 6 additions and 1 deletions

View File

@ -847,6 +847,7 @@ class AbstractDigestAuthHandler:
self.add_password = self.passwd.add_password
self.retried = 0
self.nonce_count = 0
self.last_nonce = None
def reset_retry_count(self):
self.retried = 0
@ -922,7 +923,11 @@ class AbstractDigestAuthHandler:
# XXX selector: what about proxies and full urls
req.selector)
if qop == 'auth':
self.nonce_count += 1
if nonce == self.last_nonce:
self.nonce_count += 1
else:
self.nonce_count = 1
self.last_nonce = nonce
ncvalue = '%08x' % self.nonce_count
cnonce = self.get_cnonce(nonce)
noncebit = "%s:%s:%s:%s:%s" % (nonce, ncvalue, cnonce, qop, H(A2))