Handle IPv6 addresses in split_host_port (#1533)

This PR makes split_host_port return IPv6 address without enclosing brackets.
This is due to the fact that e.g. socket.* functions expect host not to contain them when being called with IPv6.

Close: #1532
This commit is contained in:
Mateusz Kowalski
2020-05-29 14:13:33 +02:00
committed by GitHub
parent 6a0d2924a0
commit 798c46bc03
+2
View File
@@ -357,6 +357,8 @@ def polling_loop(timeout, interval=1):
def split_host_port(value, default_port):
t = value.rsplit(':', 1)
if ':' in t[0]:
t[0] = t[0].strip('[]')
t.append(default_port)
return t[0], int(t[1])