Search for "compatible" in all requests, not only the first one

This commit is contained in:
Gregory Soutade 2023-02-18 08:48:57 +01:00
parent b29765dda9
commit a5bef4ece6

View File

@ -76,9 +76,11 @@ class IWLAPreAnalysisRobots(IPlugin):
self.logger.debug('%s is a robot (caller %s:%d)' % (k, info.function, info.lineno)) self.logger.debug('%s is a robot (caller %s:%d)' % (k, info.function, info.lineno))
super_hit['robot'] = 1 super_hit['robot'] = 1
super_hit['keep_requests'] = False super_hit['keep_requests'] = False
robot_name = self.compatible_re.match(super_hit['requests'][0]['http_user_agent']) for hit in super_hit['requests']:
if robot_name: robot_name = self.compatible_re.match(hit['http_user_agent'])
super_hit['robot_name'] = robot_name[1] if robot_name:
super_hit['robot_name'] = robot_name[1]
break
# Basic rule to detect robots # Basic rule to detect robots
def hook(self): def hook(self):