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

This commit is contained in:
Senthil Kumaran 2010-08-26 06:16:22 +00:00
parent 0e10206f2c
commit 4bb5c273c6
2 changed files with 7 additions and 1 deletions

View 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)

View File

@ -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.