Patch related to the #5700

This commit is contained in:
Miroslav Stampar
2024-05-09 16:14:57 +02:00
parent 163a5f374a
commit 9bbf70790c
3 changed files with 9 additions and 9 deletions

View File

@@ -914,12 +914,6 @@ class Connect(object):
raise SqlmapConnectionException(warnMsg)
finally:
if isinstance(page, six.binary_type):
if HTTP_HEADER.CONTENT_TYPE in (responseHeaders or {}) and not re.search(TEXT_CONTENT_TYPE_REGEX, responseHeaders[HTTP_HEADER.CONTENT_TYPE]):
page = six.text_type(page, errors="ignore")
else:
page = getUnicode(page)
for function in kb.postprocessFunctions:
try:
page, responseHeaders, code = function(page, responseHeaders, code)
@@ -928,6 +922,12 @@ class Connect(object):
errMsg += "function '%s' ('%s')" % (function.__name__, getSafeExString(ex))
raise SqlmapGenericException(errMsg)
if isinstance(page, six.binary_type):
if HTTP_HEADER.CONTENT_TYPE in (responseHeaders or {}) and not re.search(TEXT_CONTENT_TYPE_REGEX, responseHeaders[HTTP_HEADER.CONTENT_TYPE]):
page = six.text_type(page, errors="ignore")
else:
page = getUnicode(page)
for _ in (getattr(conn, "redcode", None), code):
if _ is not None and _ in conf.abortCode:
errMsg = "aborting due to detected HTTP code '%d'" % _