In case that cookie file is given and cookie header inside request file clashes with one of contained cookies, give cookie file greater priority

This commit is contained in:
Miroslav Stampar 2013-04-12 19:20:33 +02:00
parent 7edd7ee2aa
commit ed5599f489

View File

@ -58,8 +58,13 @@ def forgeHeaders(items=None):
if conf.cj:
if HTTP_HEADER.COOKIE in headers:
for cookie in conf.cj:
if cookie.domain_specified and not conf.hostname.endswith(cookie.domain):
continue
if ("%s=" % cookie.name) in headers[HTTP_HEADER.COOKIE]:
if kb.mergeCookies is None:
if conf.loadCookies:
conf.httpHeaders = filter(None, ((item if item[0] != HTTP_HEADER.COOKIE else None) for item in conf.httpHeaders))
elif kb.mergeCookies is None:
message = "you provided a HTTP %s header value. " % HTTP_HEADER.COOKIE
message += "The target URL provided its own cookies within "
message += "the HTTP %s header which intersect with yours. " % HTTP_HEADER.SET_COOKIE