support for different representations of IPv4 in IPv6, thanks Jonathan

This commit is contained in:
mdipierro
2013-05-05 13:31:06 -05:00
committed by Tim Richardson
parent cabef57851
commit f02240acd3
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.4.6-stable+timestamp.2013.05.05.10.12.31
Version 2.4.6-stable+timestamp.2013.05.05.13.30.20
+2 -2
View File
@@ -305,8 +305,8 @@ def is_loopback_ip_address(ip=None, addrinfo=None):
ip = addrinfo[4]
if not isinstance(ip, basestring):
return False
if ip.count('.') == 3: # IPv4
return ip.startswith('127') or ip.startswith('::127') or ip.startswith(' 0:0:0:0:0:0:127')
if ip.count('.') == 3: # IPv4 or IPv6-embedded IPv4 or IPv4-compatible IPv6
return ip.lower().startswith(('127', '::127', '0:0:0:0:0:0:127', '::ffff:127', '0:0:0:0:0:ffff:127'))
return ip == '::1' or ip == '0:0:0:0:0:0:0:1' # IPv6 loopback