Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fec8a5c

Browse files
committed
Fix for an Issue #139
1 parent 3a60d3b commit fec8a5c

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

lib/core/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,9 @@
502502
# Connection chunk size (processing large responses in chunks to avoid MemoryError crashes - e.g. large table dump in full UNION/inband injections)
503503
MAX_CONNECTION_CHUNK_SIZE = 10 * 1024 * 1024
504504

505+
# Maximum response total page size (trimmed if larger)
506+
MAX_CONNECTION_TOTAL_SIZE = 100 * 1024 * 1024
507+
505508
# Mark used for trimming unnecessary content in large chunks
506509
LARGE_CHUNK_TRIM_MARKER = "__TRIMMED_CONTENT__"
507510

lib/request/connect.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
from lib.core.settings import HTTP_ACCEPT_ENCODING_HEADER_VALUE
5252
from lib.core.settings import HTTP_SILENT_TIMEOUT
5353
from lib.core.settings import MAX_CONNECTION_CHUNK_SIZE
54+
from lib.core.settings import MAX_CONNECTION_TOTAL_SIZE
5455
from lib.core.settings import META_REFRESH_REGEX
5556
from lib.core.settings import MIN_TIME_RESPONSES
5657
from lib.core.settings import IS_WIN
@@ -139,6 +140,11 @@ def __connReadProxy(conn):
139140
retVal += _
140141
break
141142

143+
if len(retVal) > MAX_CONNECTION_TOTAL_SIZE:
144+
warnMsg = "too large response detected. Automatically trimming it"
145+
singleTimeWarnMessage(warnMsg)
146+
break
147+
142148
return retVal
143149

144150
@staticmethod

0 commit comments

Comments
 (0)