Better handling of CookieJar Runtime Exception (#5206)

Fixes #5187
This commit is contained in:
Fabian Ising 2022-10-21 19:10:43 +02:00 committed by GitHub
parent 2ace4ef471
commit c382321134
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -587,14 +587,9 @@ class Connect(object):
if not getRequestHeader(req, HTTP_HEADER.COOKIE) and conf.cj: if not getRequestHeader(req, HTTP_HEADER.COOKIE) and conf.cj:
conf.cj._policy._now = conf.cj._now = int(time.time()) conf.cj._policy._now = conf.cj._now = int(time.time())
while True: with conf.cj._cookies_lock:
try: cookies = conf.cj._cookies_for_request(req)
cookies = conf.cj._cookies_for_request(req) requestHeaders += "\r\n%s" % ("Cookie: %s" % ";".join("%s=%s" % (getUnicode(cookie.name), getUnicode(cookie.value)) for cookie in cookies))
except RuntimeError: # NOTE: https://github.com/sqlmapproject/sqlmap/issues/5187
time.sleep(1)
else:
requestHeaders += "\r\n%s" % ("Cookie: %s" % ";".join("%s=%s" % (getUnicode(cookie.name), getUnicode(cookie.value)) for cookie in cookies))
break
if post is not None: if post is not None:
if not getRequestHeader(req, HTTP_HEADER.CONTENT_LENGTH) and not chunked: if not getRequestHeader(req, HTTP_HEADER.CONTENT_LENGTH) and not chunked: