From 8e7449ccd5feb28ca0f97e1f11bb776acee50ae1 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Sun, 7 Oct 2012 20:28:24 +0200 Subject: [PATCH] Minor update --- lib/core/option.py | 10 +++++----- lib/request/basic.py | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/core/option.py b/lib/core/option.py index 633b612d8..e4992f561 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -201,7 +201,7 @@ def __feedTargetsDict(reqFile, addedTargetUrls): logger.debug("not a valid WebScarab log data") continue - if method.upper() == "POST": + if method.upper() == HTTPMETHOD.POST: warnMsg = "POST requests from WebScarab logs aren't supported " warnMsg += "as their body content is stored in separate files. " warnMsg += "Nevertheless you can use -r to load them individually." @@ -1170,24 +1170,24 @@ def __setHTTPUserAgent(): item = item[item.find(';') + 1:] - conf.httpHeaders.append(("User-Agent", item)) + conf.httpHeaders.append((HTTPHEADER.USER_AGENT, item)) elif conf.agent: debugMsg = "setting the HTTP User-Agent header" logger.debug(debugMsg) - conf.httpHeaders.append(("User-Agent", conf.agent)) + conf.httpHeaders.append((HTTPHEADER.USER_AGENT, conf.agent)) elif not conf.randomAgent: _ = True for header, _ in conf.httpHeaders: - if header == "User-Agent": + if header == HTTPHEADER.USER_AGENT: _ = False break if _: - conf.httpHeaders.append(("User-Agent", __defaultHTTPUserAgent())) + conf.httpHeaders.append((HTTPHEADER.USER_AGENT, __defaultHTTPUserAgent())) else: if not kb.userAgents: diff --git a/lib/request/basic.py b/lib/request/basic.py index 50c900305..7ff5833ec 100644 --- a/lib/request/basic.py +++ b/lib/request/basic.py @@ -51,6 +51,8 @@ def forgeHeaders(items=None): headers = dict(conf.httpHeaders) headers.update(items or {}) + headers = dict(("-".join(_.capitalize() for _ in key.split('-')), value) for (key, value) in headers.items()) + if conf.cj: if HTTPHEADER.COOKIE in headers: for cookie in conf.cj: