]> granicus.if.org Git - python/commitdiff
Merged revisions 84323 via svnmerge from
authorSenthil Kumaran <orsenthil@gmail.com>
Thu, 26 Aug 2010 06:24:04 +0000 (06:24 +0000)
committerSenthil Kumaran <orsenthil@gmail.com>
Thu, 26 Aug 2010 06:24:04 +0000 (06:24 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84323 | senthil.kumaran | 2010-08-26 11:46:22 +0530 (Thu, 26 Aug 2010) | 3 lines

  Fix Issue8797 - Reset the basic auth retry count when response code is not 401.
........

Lib/urllib/request.py
Misc/NEWS

index 4beafc16320baa2e7918b6952fdf36f0392c424b..c638cfa510639a6528030493f932cda72eeaef5a 100644 (file)
@@ -799,7 +799,10 @@ class AbstractBasicAuthHandler:
             if mo:
                 scheme, quote, realm = mo.groups()
                 if scheme.lower() == 'basic':
-                    return self.retry_http_basic_auth(host, req, realm)
+                    response = self.retry_http_basic_auth(host, req, realm)
+                    if response and response.code != 401:
+                        self.retried = 0
+                    return response
 
     def retry_http_basic_auth(self, host, req, realm):
         user, pw = self.passwd.find_user_password(realm, host)
index 4bedeb0a53795c1c4b4e9a459618d4cc8336e57f..4942fa210ef3f24b4f0cd3ea73aaa6a268957928 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -97,6 +97,9 @@ C-API
 Library
 -------
 
+- Issue #8797: urllib2 does a retry for Basic Authentication failure instead of
+  falling into recursion.
+
 - Issue #1194222: email.utils.parsedate now returns RFC2822 compliant four
   character years even if the message contains RFC822 two character years.