[Python-checkins] r84323 - in python/branches/py3k: Lib/urllib/request.py Misc/NEWS

senthil.kumaran python-checkins at python.org
Thu Aug 26 08:16:22 CEST 2010


Author: senthil.kumaran
Date: Thu Aug 26 08:16:22 2010
New Revision: 84323

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



Modified:
   python/branches/py3k/Lib/urllib/request.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/urllib/request.py
==============================================================================
--- python/branches/py3k/Lib/urllib/request.py	(original)
+++ python/branches/py3k/Lib/urllib/request.py	Thu Aug 26 08:16:22 2010
@@ -799,7 +799,10 @@
             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)

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Thu Aug 26 08:16:22 2010
@@ -132,6 +132,9 @@
 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.
 


More information about the Python-checkins mailing list