Fix for an Issue #368

This commit is contained in:
Miroslav Stampar 2013-01-23 13:36:17 +01:00
parent 7ee07d031a
commit 232f8d3585

View File

@ -255,10 +255,13 @@ def _feedTargetsDict(reqFile, addedTargetUrls):
data = None data = None
cookie = None cookie = None
params = False params = False
lines = request.split("\n") newline = None
lines = request.split('\n')
for line in lines: for line in lines:
if len(line) == 0 or line == "\n": newline = "\r\n" if line.endswith('\r') else '\n'
line = line.strip('\r')
if len(line) == 0:
if method == HTTPMETHOD.POST and data is None: if method == HTTPMETHOD.POST and data is None:
data = "" data = ""
params = True params = True
@ -279,7 +282,7 @@ def _feedTargetsDict(reqFile, addedTargetUrls):
# POST parameters # POST parameters
elif data is not None and params: elif data is not None and params:
data += "%s%s" % ("\n" if data else "", line) data += "%s%s" % (line, newline)
# GET parameters # GET parameters
elif "?" in line and "=" in line and ": " not in line: elif "?" in line and "=" in line and ": " not in line:
@ -299,7 +302,7 @@ def _feedTargetsDict(reqFile, addedTargetUrls):
host = splitValue[0] host = splitValue[0]
if len(splitValue) > 1: if len(splitValue) > 1:
port = filterStringValue(splitValue[1], '[0-9]') port = filterStringValue(splitValue[1], "[0-9]")
# Avoid to add a static content length header to # Avoid to add a static content length header to
# conf.httpHeaders and consider the following lines as # conf.httpHeaders and consider the following lines as
@ -334,7 +337,6 @@ def _feedTargetsDict(reqFile, addedTargetUrls):
fp = openFile(reqFile, "rb") fp = openFile(reqFile, "rb")
content = fp.read() content = fp.read()
content = content.replace("\r", "")
if conf.scope: if conf.scope:
logger.info("using regular expression '%s' for filtering targets" % conf.scope) logger.info("using regular expression '%s' for filtering targets" % conf.scope)