|
43 | 43 | from lib.core.settings import BLOCKED_IP_REGEX |
44 | 44 | from lib.core.settings import DEFAULT_COOKIE_DELIMITER |
45 | 45 | from lib.core.settings import EVENTVALIDATION_REGEX |
| 46 | +from lib.core.settings import HEURISTIC_PAGE_SIZE_THRESHOLD |
46 | 47 | from lib.core.settings import IDENTYWAF_PARSE_LIMIT |
47 | | -from lib.core.settings import MAX_CHAR_HEURISTICS_SIZE |
48 | 48 | from lib.core.settings import MAX_CONNECTION_TOTAL_SIZE |
49 | 49 | from lib.core.settings import META_CHARSET_REGEX |
50 | 50 | from lib.core.settings import PARSE_HEADERS_LIMIT |
@@ -259,7 +259,7 @@ def getHeuristicCharEncoding(page): |
259 | 259 | """ |
260 | 260 |
|
261 | 261 | key = hash(page) |
262 | | - retVal = kb.cache.encoding.get(key) or detect(page[:MAX_CHAR_HEURISTICS_SIZE])["encoding"] |
| 262 | + retVal = kb.cache.encoding.get(key) or detect(page[:HEURISTIC_PAGE_SIZE_THRESHOLD])["encoding"] |
263 | 263 | kb.cache.encoding[key] = retVal |
264 | 264 |
|
265 | 265 | if retVal and retVal.lower().replace('-', "") == UNICODE_ENCODING.lower().replace('-', ""): |
@@ -396,7 +396,7 @@ def processResponse(page, responseHeaders, code=None, status=None): |
396 | 396 | logger.warning("parsed DBMS error message: '%s'" % msg.rstrip('.')) |
397 | 397 |
|
398 | 398 | if not conf.skipWaf and kb.processResponseCounter < IDENTYWAF_PARSE_LIMIT: |
399 | | - rawResponse = "%s %s %s\n%s\n%s" % (_http_client.HTTPConnection._http_vsn_str, code or "", status or "", "".join(getUnicode(responseHeaders.headers if responseHeaders else [])), page[:MAX_CHAR_HEURISTICS_SIZE]) |
| 399 | + rawResponse = "%s %s %s\n%s\n%s" % (_http_client.HTTPConnection._http_vsn_str, code or "", status or "", "".join(getUnicode(responseHeaders.headers if responseHeaders else [])), page[:HEURISTIC_PAGE_SIZE_THRESHOLD]) |
400 | 400 |
|
401 | 401 | identYwaf.non_blind.clear() |
402 | 402 | if identYwaf.non_blind_check(rawResponse, silent=True): |
|
0 commit comments