mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-01-24 08:14:24 +03:00
minor update to make counting variable totally independent of the urllib2's self.retried
This commit is contained in:
parent
a010386a23
commit
3a1f5744be
|
@ -17,6 +17,7 @@ class SmartHTTPBasicAuthHandler(urllib2.HTTPBasicAuthHandler):
|
|||
def __init__(self, *args, **kwargs):
|
||||
urllib2.HTTPBasicAuthHandler.__init__(self, *args, **kwargs)
|
||||
self.retried_req = set()
|
||||
self.retried_count = 0
|
||||
|
||||
def reset_retry_count(self):
|
||||
# Python 2.6.5 will call this on 401 or 407 errors and thus loop
|
||||
|
@ -28,13 +29,13 @@ class SmartHTTPBasicAuthHandler(urllib2.HTTPBasicAuthHandler):
|
|||
# Reset the retry counter once for each request.
|
||||
if hash(req) not in self.retried_req:
|
||||
self.retried_req.add(hash(req))
|
||||
self.retried = 0
|
||||
self.retried_count = 0
|
||||
else:
|
||||
if self.retried > 5:
|
||||
if self.retried_count > 5:
|
||||
raise urllib2.HTTPError(req.get_full_url(), 401, "basic auth failed",
|
||||
headers, None)
|
||||
else:
|
||||
self.retried += 1
|
||||
self.retried_count += 1
|
||||
|
||||
return urllib2.HTTPBasicAuthHandler.http_error_auth_reqed(
|
||||
self, auth_header, host, req, headers)
|
||||
|
|
Loading…
Reference in New Issue
Block a user