[Python-checkins] r76289 - in python/branches/release26-maint: Lib/urllib2.py

senthil.kumaran python-checkins at python.org
Sun Nov 15 09:39:10 CET 2009


Author: senthil.kumaran
Date: Sun Nov 15 09:39:10 2009
New Revision: 76289

Log:
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)
........


Modified:
   python/branches/release26-maint/   (props changed)
   python/branches/release26-maint/Lib/urllib2.py

Modified: python/branches/release26-maint/Lib/urllib2.py
==============================================================================
--- python/branches/release26-maint/Lib/urllib2.py	(original)
+++ python/branches/release26-maint/Lib/urllib2.py	Sun Nov 15 09:39:10 2009
@@ -901,6 +901,7 @@
         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 @@
                         # 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))


More information about the Python-checkins mailing list