Squid url redirector

Diff
anonymous

Diff

Differences From Artifact [15ab41beb3]:

To Artifact [59906f1a4b]:


62
63
64
65
66
67
68
69

70
71
72
73
74
75
76

77
78
79
80
81
82
83
62
63
64
65
66
67
68

69
70
71
72
73
74
75

76
77
78
79
80
81
82
83







-
+






-
+







		reply = '-'
		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 = '302:' + row[0]
							reply = row[0].format(url_path)
							break
						else:
							continue
					except:
						self._log.info("can't compile regexp")
				else:
					reply = '302:' + row[0]
					reply = row[0].format(url_path)
					break
		self.writeline('{} {}\n'.format(id, reply))

	def check(self, line):
		request = re.compile('^([0-9]+)\ (http|ftp):\/\/([-\w.:]+)\/([^ ]*)\ ([0-9.]+)\/(-|[\w\.]+)\ (-|\w+)\ (-|GET|HEAD|POST).*$').match(line)
		if request:
			id = request.group(1)