summaryrefslogtreecommitdiff
path: root/Lib/urllib2.py
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2009-11-15 08:39:10 +0000
committerSenthil Kumaran <orsenthil@gmail.com>2009-11-15 08:39:10 +0000
commit10c858ac4d80ef4b50a96ae57c128178d5ecfa05 (patch)
tree0dceb1cd3d82ad45851151fa1952ccc3948e522f /Lib/urllib2.py
parent38b5dd13eb752b8211c1ae81697c821a8dbe1674 (diff)
downloadcpython-git-10c858ac4d80ef4b50a96ae57c128178d5ecfa05.tar.gz
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) ........
Diffstat (limited to 'Lib/urllib2.py')
-rw-r--r--Lib/urllib2.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index 1778675814..03bd5f8af2 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -901,6 +901,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
@@ -975,7 +976,12 @@ class AbstractDigestAuthHandler:
# XXX selector: what about proxies and full urls
req.get_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))