Skip to content

Commit c382321

Browse files
authored
Better handling of CookieJar Runtime Exception (#5206)
Fixes #5187
1 parent 2ace4ef commit c382321

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

lib/request/connect.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -587,14 +587,9 @@ class _(dict):
587587

588588
if not getRequestHeader(req, HTTP_HEADER.COOKIE) and conf.cj:
589589
conf.cj._policy._now = conf.cj._now = int(time.time())
590-
while True:
591-
try:
592-
cookies = conf.cj._cookies_for_request(req)
593-
except RuntimeError: # NOTE: https://github.com/sqlmapproject/sqlmap/issues/5187
594-
time.sleep(1)
595-
else:
596-
requestHeaders += "\r\n%s" % ("Cookie: %s" % ";".join("%s=%s" % (getUnicode(cookie.name), getUnicode(cookie.value)) for cookie in cookies))
597-
break
590+
with conf.cj._cookies_lock:
591+
cookies = conf.cj._cookies_for_request(req)
592+
requestHeaders += "\r\n%s" % ("Cookie: %s" % ";".join("%s=%s" % (getUnicode(cookie.name), getUnicode(cookie.value)) for cookie in cookies))
598593

599594
if post is not None:
600595
if not getRequestHeader(req, HTTP_HEADER.CONTENT_LENGTH) and not chunked:

0 commit comments

Comments
 (0)