Index: squid-tagger.py ================================================================== --- squid-tagger.py +++ squid-tagger.py @@ -81,27 +81,28 @@ self._request = re.compile('^([0-9]+)\ (http|ftp):\/\/([-\w.:]+)\/([^ ]*)\ ([0-9.]+)\/(-|[\w\.]+)\ (-|\w+)\ (-|GET|HEAD|POST).*$') def process(self, id, site, ip_address, url_path, line = None): self._log.info('trying {}\n'.format(site)) result = self._db.check(site, ip_address) - reply = '-' + reply = None for row in result: if row != None and row[0] != None: if row[1] != None: self._log.info('trying regexp "{}" versus "{}"\n'.format(row[1], url_path)) try: if re.compile(row[1]).match(url_path): reply = row[0].format(url_path) - break else: continue except: self._log.info("can't compile regexp") else: reply = row[0].format(url_path) - break - self.writeline('{} {}\n'.format(id, reply)) + if reply != None: + self.writeline('{} {}\n'.format(id, reply)) + return(True) + self.writeline('{}\n'.format(id)) def check(self, line): request = self._request.match(line) if request: id = request.group(1)