Squid url redirector

Check-in [d2c54d0451]
anonymous

Check-in [d2c54d0451]

Overview
Comment:added logged fail when compiling regexp
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: d2c54d04516b49843209bfb6c53a484a90536ecd932ed390953f2a714078f71c
User & Date: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 on 2010-03-01 14:29:13.000
Other Links: branch diff | manifest | tags
Context
2010-03-18
15:26
* reworked indexes * added scripts to dump/load db check-in: f1bafd194a user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk
2010-03-01
14:29
added logged fail when compiling regexp check-in: d2c54d0451 user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk
2009-12-15
20:57
functions reorderd, added missing letter to declaration check-in: 12c35e5674 user: c.kworr@d4daf22a-8aaf-11de-a64d-234b64dd91b4 tags: master, trunk
Changes
60
61
62
63
64
65
66

67
68
69
70
71


72
73
74
75
76
77
78
		result = self._db.check(site, ip_address)
		#reply = '{}://{}/{}'.format(req[4], req[1], req[3])
		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))

					if re.compile(row[1]).match(url_path):
						reply = '302:' + row[0]
						break
					else:
						continue


				else:
					reply = '302:' + row[0]
					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)







>
|
|
|
|
|
>
>







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
		result = self._db.check(site, ip_address)
		#reply = '{}://{}/{}'.format(req[4], req[1], req[3])
		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]
							break
						else:
							continue
					except:
						self._log.info("can't compile regexp")
				else:
					reply = '302:' + row[0]
					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)