Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ed5599f

Browse files
committed
In case that cookie file is given and cookie header inside request file clashes with one of contained cookies, give cookie file greater priority
1 parent 7edd7ee commit ed5599f

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/request/basic.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,13 @@ def forgeHeaders(items=None):
5858
if conf.cj:
5959
if HTTP_HEADER.COOKIE in headers:
6060
for cookie in conf.cj:
61+
if cookie.domain_specified and not conf.hostname.endswith(cookie.domain):
62+
continue
63+
6164
if ("%s=" % cookie.name) in headers[HTTP_HEADER.COOKIE]:
62-
if kb.mergeCookies is None:
65+
if conf.loadCookies:
66+
conf.httpHeaders = filter(None, ((item if item[0] != HTTP_HEADER.COOKIE else None) for item in conf.httpHeaders))
67+
elif kb.mergeCookies is None:
6368
message = "you provided a HTTP %s header value. " % HTTP_HEADER.COOKIE
6469
message += "The target URL provided its own cookies within "
6570
message += "the HTTP %s header which intersect with yours. " % HTTP_HEADER.SET_COOKIE

0 commit comments

Comments
 (0)