diff options
author | Chris Porter <slug@qwebirc.org> | 2012-02-13 01:23:27 (GMT) |
---|---|---|
committer | Chris Porter <slug@qwebirc.org> | 2012-02-13 01:23:27 (GMT) |
commit | bc91808a1a8de83da71130a09a7c8fe458d415e5 (patch) | |
tree | 09ac2c66f5a6e7e198dd7f937cd6635cf1b306ef | |
parent | be461394f003b1c82b0ac0a198b63556666ebe63 (diff) |
Fixes issue #233
-rw-r--r-- | qwebirc/root.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/qwebirc/root.py b/qwebirc/root.py index 73d039a..fe6fc95 100644 --- a/qwebirc/root.py +++ b/qwebirc/root.py @@ -37,12 +37,12 @@ class TimeoutHTTPChannel(http.HTTPChannel): http.HTTPChannel.connectionLost(self, reason) class ProxyRequest(server.Request): - ip_re = re.compile(r"^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$") + ip_re = re.compile(r"^((25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})[.](25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})[.](25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})[.](25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{1,2})|(::|(([a-fA-F0-9]{1,4}):){7}(([a-fA-F0-9]{1,4}))|(:(:([a-fA-F0-9]{1,4})){1,6})|((([a-fA-F0-9]{1,4}):){1,6}:)|((([a-fA-F0-9]{1,4}):)(:([a-fA-F0-9]{1,4})){1,6})|((([a-fA-F0-9]{1,4}):){2}(:([a-fA-F0-9]{1,4})){1,5})|((([a-fA-F0-9]{1,4}):){3}(:([a-fA-F0-9]{1,4})){1,4})|((([a-fA-F0-9]{1,4}):){4}(:([a-fA-F0-9]{1,4})){1,3})|((([a-fA-F0-9]{1,4}):){5}(:([a-fA-F0-9]{1,4})){1,2})))$", re.IGNORECASE) def validIP(self, ip): m = self.ip_re.match(ip) if m is None: return False - return all(int(m.group(x)) < 256 for x in range(1, 4+1)) + return True def getClientIP(self): real_ip = http.Request.getClientIP(self) |