From 042e3f76ba6f6a78232c998912d07a4bdf9dfeec Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 5 Jan 2011 11:36:40 +0000 Subject: [PATCH] bug fix for a bug reported by nightman (RuntimeError: maximum recursion depth exceeded) --- lib/request/basicauthhandler.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/request/basicauthhandler.py b/lib/request/basicauthhandler.py index 7557ccfde..2da733ef5 100644 --- a/lib/request/basicauthhandler.py +++ b/lib/request/basicauthhandler.py @@ -16,7 +16,7 @@ class SmartHTTPBasicAuthHandler(urllib2.HTTPBasicAuthHandler): """ def __init__(self, *args, **kwargs): urllib2.HTTPBasicAuthHandler.__init__(self, *args, **kwargs) - self.retried_req = None + self.retried_req = [] def reset_retry_count(self): # Python 2.6.5 will call this on 401 or 407 errors and thus loop @@ -26,8 +26,8 @@ class SmartHTTPBasicAuthHandler(urllib2.HTTPBasicAuthHandler): def http_error_auth_reqed(self, auth_header, host, req, headers): # Reset the retry counter once for each request. - if req is not self.retried_req: - self.retried_req = req + if req not in self.retried_req: + self.retried_req.append(req) self.retried = 0 return urllib2.HTTPBasicAuthHandler.http_error_auth_reqed( self, auth_header, host, req, headers)