aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorGravatar jesopo2019-09-30 15:12:01 +0100
committerGravatar jesopo2019-09-30 15:12:01 +0100
commitb9c64b7cf17c775d6a5b94cec2460c8f6753aa73 (patch)
tree3ae7855ef71c63571a9c663ae657eda0f6ad53b7 /src/utils
parentonly _kill() when there's no servers *and* the event queue is empty (diff)
signature
use ipaddress is_loopback etc to do better forbidden ranges
closes #87
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/http.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/utils/http.py b/src/utils/http.py
index 49738876..00066033 100644
--- a/src/utils/http.py
+++ b/src/utils/http.py
@@ -301,5 +301,14 @@ def is_localhost(hostname: str) -> bool:
address = ipaddress.ip_address(link["addr"].split("%", 1)[0])
if address in ips:
return True
+ for ip in ips:
+ if ip.version == 6 and ip.ipv4_mapped:
+ ip = ip.ipv4_mapped
+
+ if (ip.is_loopback or
+ ip.is_link_local or
+ ip.is_multicast or
+ ip.is_private):
+ return True
return False