mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-01-12 01:29:02 +00:00
Fixing thread-safety in getHeuristicCharEncoding
This commit is contained in:
@@ -259,8 +259,11 @@ def getHeuristicCharEncoding(page):
|
||||
"""
|
||||
|
||||
key = (len(page), hash(page))
|
||||
retVal = kb.cache.encoding[key] if key in kb.cache.encoding else detect(page[:HEURISTIC_PAGE_SIZE_THRESHOLD])["encoding"]
|
||||
kb.cache.encoding[key] = retVal
|
||||
|
||||
retVal = kb.cache.encoding.get(key)
|
||||
if retVal is None:
|
||||
retVal = detect(page[:HEURISTIC_PAGE_SIZE_THRESHOLD])["encoding"]
|
||||
kb.cache.encoding[key] = retVal
|
||||
|
||||
if retVal and retVal.lower().replace('-', "") == UNICODE_ENCODING.lower().replace('-', ""):
|
||||
infoMsg = "heuristics detected web page charset '%s'" % retVal
|
||||
|
||||
Reference in New Issue
Block a user