]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix Issue8797 - Reset the basic auth retry count when response code is not 401.
authorSenthil Kumaran <orsenthil@gmail.com>
Thu, 26 Aug 2010 06:16:22 +0000 (06:16 +0000)
committerSenthil Kumaran <orsenthil@gmail.com>
Thu, 26 Aug 2010 06:16:22 +0000 (06:16 +0000)
Lib/urllib/request.py
Misc/NEWS

index 68a8cabda1bea202efd3cfcff2a2abea255c10fa..16d81252d310c19676ee9dbb92264b00af2380c7 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 ecb1a4f4a098796b02be9ff7509ed97ce56aa76d..7ef147d22ce82c8b1aeb70d5bb120f64fc38b39f 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -132,6 +132,9 @@ Extensions
 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.