Skip to content

Commit c1516f1

Browse files
committed
Fixes #6080
1 parent 5893f06 commit c1516f1

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty import six
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.10.7.50"
23+
VERSION = "1.10.7.51"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/request/redirecthandler.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,20 @@ def http_error_302(self, req, fp, code, msg, headers):
8282
redurl = self._get_header_redirect(headers) if not conf.ignoreRedirects else None
8383

8484
try:
85-
content = fp.fp.read(MAX_CONNECTION_TOTAL_SIZE)
86-
fp.fp = io.BytesIO(content)
85+
# Note: drain via the length-aware response (honors Content-Length/chunked), NOT the raw
86+
# socket 'fp.fp' - the latter has no HTTP framing, so on a Keep-Alive connection (no EOF)
87+
# it blocks for the whole '--timeout' on every redirect (Issue #6080)
88+
content = fp.read(MAX_CONNECTION_TOTAL_SIZE)
8789
except _http_client.IncompleteRead as ex:
8890
content = ex.partial
89-
fp.fp = io.BytesIO(content)
9091
except:
9192
content = b""
9293

94+
# back 'fp' with the captured body so it stays re-readable downstream (Issue #5985); the
95+
# length-aware read above has consumed the response, so restore both the buffer and read()
96+
fp.fp = io.BytesIO(content)
97+
fp.read = fp.fp.read
98+
9399
content = decodePage(content, headers.get(HTTP_HEADER.CONTENT_ENCODING), headers.get(HTTP_HEADER.CONTENT_TYPE))
94100

95101
threadData = getCurrentThreadData()

0 commit comments

Comments
 (0)