Fixes #6080
Some checks are pending
/ build (macos-latest, 3.8) (push) Waiting to run
/ build (ubuntu-latest, pypy-2.7) (push) Waiting to run
/ build (windows-latest, 3.14) (push) Waiting to run

This commit is contained in:
Miroslav Štampar 2026-07-09 09:02:25 +02:00
parent 5893f069ae
commit c1516f1750
2 changed files with 10 additions and 4 deletions

View file

@ -20,7 +20,7 @@ from lib.core.enums import OS
from thirdparty import six
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.10.7.50"
VERSION = "1.10.7.51"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

View file

@ -82,14 +82,20 @@ class SmartRedirectHandler(_urllib.request.HTTPRedirectHandler):
redurl = self._get_header_redirect(headers) if not conf.ignoreRedirects else None
try:
content = fp.fp.read(MAX_CONNECTION_TOTAL_SIZE)
fp.fp = io.BytesIO(content)
# Note: drain via the length-aware response (honors Content-Length/chunked), NOT the raw
# socket 'fp.fp' - the latter has no HTTP framing, so on a Keep-Alive connection (no EOF)
# it blocks for the whole '--timeout' on every redirect (Issue #6080)
content = fp.read(MAX_CONNECTION_TOTAL_SIZE)
except _http_client.IncompleteRead as ex:
content = ex.partial
fp.fp = io.BytesIO(content)
except:
content = b""
# back 'fp' with the captured body so it stays re-readable downstream (Issue #5985); the
# length-aware read above has consumed the response, so restore both the buffer and read()
fp.fp = io.BytesIO(content)
fp.read = fp.fp.read
content = decodePage(content, headers.get(HTTP_HEADER.CONTENT_ENCODING), headers.get(HTTP_HEADER.CONTENT_TYPE))
threadData = getCurrentThreadData()