@@ -46,29 +46,26 @@ def _adjust(condition, getRatioValue):
4646def _comparison (page , headers , code , getRatioValue , pageLength ):
4747 threadData = getCurrentThreadData ()
4848
49- if kb .testMode :
50- threadData .lastComparisonPage = page
49+ if kb .testMode or any (( conf . string , conf . notString , conf . regexp )) :
50+ threadData .lastComparisonContent = "%s%s" % ( listToStrValue ( headers . headers if headers else "" ), page or "" )
5151
5252 if page is None and pageLength is None :
5353 return None
5454
5555 seqMatcher = threadData .seqMatcher
5656 seqMatcher .set_seq1 (kb .pageTemplate )
5757
58- if any ((conf .string , conf .notString , conf .regexp )):
59- rawResponse = "%s%s" % (listToStrValue (headers .headers if headers else "" ), page )
58+ # String to match in page when the query is True and/or valid
59+ if conf .string :
60+ return conf .string in threadData .lastComparisonContent
6061
61- # String to match in page when the query is True and/or valid
62- if conf .string :
63- return conf .string in rawResponse
62+ # String to match in page when the query is False and/or invalid
63+ if conf .notString :
64+ return conf .notString not in threadData . lastComparisonContent
6465
65- # String to match in page when the query is False and/or invalid
66- if conf .notString :
67- return conf .notString not in rawResponse
68-
69- # Regular expression to match in page when the query is True and/or valid
70- if conf .regexp :
71- return re .search (conf .regexp , rawResponse , re .I | re .M ) is not None
66+ # Regular expression to match in page when the query is True and/or valid
67+ if conf .regexp :
68+ return re .search (conf .regexp , threadData .lastComparisonContent , re .I | re .M ) is not None
7269
7370 # HTTP code to match when the query is valid
7471 if conf .code :
0 commit comments