diff --git a/lib/controller/checks.py b/lib/controller/checks.py index 337dbf334..48a30949a 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -524,8 +524,6 @@ def checkDynamicContent(firstPage, secondPage): infoMsg = "dynamic content marked for removal (%d region%s)" % (len(kb.dynamicMarkings), 's' if len(kb.dynamicMarkings) > 1 else '') logger.info(infoMsg) - kb.pageTemplate = removeDynamicContent(kb.pageTemplate) - def checkStability(): """ This function checks if the URL content is stable requesting the diff --git a/lib/core/common.py b/lib/core/common.py index 402c1ec5b..c78134121 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -1642,10 +1642,10 @@ def removeDynamicContent(page): for item in kb.dynamicMarkings: prefix, suffix = item if prefix is None: - page = re.sub('(?s)^.+%s' % suffix, suffix, page) + getCompiledRegex('(?s)^.+%s' % suffix).sub(suffix, page) elif suffix is None: - page = re.sub('(?s)%s.+$' % prefix, prefix, page) + getCompiledRegex('(?s)%s.+$' % prefix).sub(prefix, page) else: - page = re.sub('(?s)%s.+%s' % (prefix, suffix), '%s%s' % (prefix, suffix), page) + getCompiledRegex('(?s)%s.+%s' % (prefix, suffix)).sub('%s%s' % (prefix, suffix), page) return page diff --git a/lib/request/comparison.py b/lib/request/comparison.py index 4192349e2..4ea8ac703 100644 --- a/lib/request/comparison.py +++ b/lib/request/comparison.py @@ -62,6 +62,7 @@ def comparison(page, headers=None, getSeqMatcher=False, pageLength=None): # Dynamic content lines to be excluded before comparison if not kb.nullConnection and not conf.longestCommon: page = removeDynamicContent(page) + conf.seqMatcher.set_seq1(removeDynamicContent(kb.pageTemplate)) if not pageLength: pageLength = len(page)