From: Michael Tremer Date: Fri, 14 Jan 2011 17:36:03 +0000 (+0100) Subject: geoip: Fix getting the ip address if user has a proxy which sends headers. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=65afea2fbe928a04eead8b1dd3081e4c98a247a6;p=ipfire.org.git geoip: Fix getting the ip address if user has a proxy which sends headers. --- diff --git a/www/webapp/backend/geoip.py b/www/webapp/backend/geoip.py index b2cdc09c..b7f3e999 100644 --- a/www/webapp/backend/geoip.py +++ b/www/webapp/backend/geoip.py @@ -11,6 +11,11 @@ class GeoIP(object): return Databases().geoip def __encode_ip(self, addr): + # We get a tuple if there were proxy headers. + addr = addr.split(", ") + if addr: + addr = addr[-1] + # ip is calculated as described in http://ipinfodb.com/ip_database.php a1, a2, a3, a4 = addr.split(".")