removed the timeout issues Issue 1488:Web2py not run OpenSUSE 12.3 64Bits but it may now work as intended
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.4.6-stable+timestamp.2013.05.11.22.01.55
|
Version 2.4.6-stable+timestamp.2013.05.11.22.10.09
|
||||||
|
|||||||
+4
-2
@@ -471,11 +471,13 @@ def wsgibase(environ, responder):
|
|||||||
local_hosts.add(socket.gethostname())
|
local_hosts.add(socket.gethostname())
|
||||||
local_hosts.add(fqdn)
|
local_hosts.add(fqdn)
|
||||||
local_hosts.update([
|
local_hosts.update([
|
||||||
addrinfo[4][0] for addrinfo in getipaddrinfo(fqdn)])
|
addrinfo[4][0] for addrinfo
|
||||||
|
in getipaddrinfo(fqdn)])
|
||||||
if env.server_name:
|
if env.server_name:
|
||||||
local_hosts.add(env.server_name)
|
local_hosts.add(env.server_name)
|
||||||
local_hosts.update([
|
local_hosts.update([
|
||||||
addrinfo[4][0] for addrinfo in getipaddrinfo(env.server_name)])
|
addrinfo[4][0] for addrinfo
|
||||||
|
in getipaddrinfo(env.server_name)])
|
||||||
except (socket.gaierror, TypeError):
|
except (socket.gaierror, TypeError):
|
||||||
pass
|
pass
|
||||||
global_settings.local_hosts = list(local_hosts)
|
global_settings.local_hosts = list(local_hosts)
|
||||||
|
|||||||
+11
-6
@@ -300,13 +300,15 @@ def is_loopback_ip_address(ip=None, addrinfo=None):
|
|||||||
Determines whether the address appears to be a loopback address.
|
Determines whether the address appears to be a loopback address.
|
||||||
This assumes that the IP is valid.
|
This assumes that the IP is valid.
|
||||||
"""
|
"""
|
||||||
if addrinfo: # see socket.getaddrinfo() for layout of addrinfo tuple
|
if addrinfo: # see socket.getaddrinfo() for layout of addrinfo tuple
|
||||||
if addrinfo[0] == socket.AF_INET or addrinfo[0] == socket.AF_INET6:
|
if addrinfo[0] == socket.AF_INET or addrinfo[0] == socket.AF_INET6:
|
||||||
ip = addrinfo[4]
|
ip = addrinfo[4]
|
||||||
if not isinstance(ip, basestring):
|
if not isinstance(ip, basestring):
|
||||||
return False
|
return False
|
||||||
if ip.count('.') == 3: # IPv4 or IPv6-embedded IPv4 or IPv4-compatible IPv6
|
# 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'))
|
if ip.count('.') == 3:
|
||||||
|
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
|
return ip == '::1' or ip == '0:0:0:0:0:0:0:1' # IPv6 loopback
|
||||||
|
|
||||||
|
|
||||||
@@ -314,7 +316,10 @@ def getipaddrinfo(host):
|
|||||||
"""
|
"""
|
||||||
Filter out non-IP and bad IP addresses from getaddrinfo
|
Filter out non-IP and bad IP addresses from getaddrinfo
|
||||||
"""
|
"""
|
||||||
return [addrinfo for addrinfo in socket.getaddrinfo(host, None)
|
try:
|
||||||
if (addrinfo[0] == socket.AF_INET or addrinfo[0] == socket.AF_INET6)
|
return [addrinfo for addrinfo in socket.getaddrinfo(host, None)
|
||||||
|
if (addrinfo[0] == socket.AF_INET or
|
||||||
|
addrinfo[0] == socket.AF_INET6)
|
||||||
and isinstance(addrinfo[4][0], basestring)]
|
and isinstance(addrinfo[4][0], basestring)]
|
||||||
|
except socket.error:
|
||||||
|
return []
|
||||||
|
|||||||
Reference in New Issue
Block a user