Skip to content

Commit

Permalink
Fix for an Issue sqlmapproject#85
Browse files Browse the repository at this point in the history
  • Loading branch information
stamparm committed Jan 2, 2014
1 parent 4de83da commit 5437f8b
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lib/request/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from lib.core.common import extractErrorMessage
from lib.core.common import extractRegexResult
from lib.core.common import getPublicTypeMembers
from lib.core.common import getUnicode
from lib.core.common import readInput
from lib.core.common import resetCookieJar
Expand Down Expand Up @@ -53,7 +54,27 @@ 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())
class _str(str):
def capitalize(self):
return _str(self)

def title(self):
return _str(self)

_ = headers
headers = {}
for key, value in _.items():
success = False
if key.upper() not in (_.upper() for _ in getPublicTypeMembers(HTTP_HEADER, True)):
try:
headers[_str(key)] = value # dirty hack for http://bugs.python.org/issue12455
except UnicodeEncodeError: # don't do the hack on non-ASCII header names (they have to be properly encoded later on)
pass
else:
success = True
if not success:
key = '-'.join(_.capitalize() for _ in key.split('-'))
headers[key] = value

if conf.cj:
if HTTP_HEADER.COOKIE in headers:
Expand Down

0 comments on commit 5437f8b

Please sign in to comment.