If listen on all interface do not return localhost as console

Fix https://github.com/GNS3/gns3-gui/issues/1574
This commit is contained in:
Julien Duponchelle
2016-10-17 18:20:29 +02:00
parent f737989e44
commit a8ffaa9cb5
3 changed files with 19 additions and 3 deletions

View File

@ -411,8 +411,16 @@ class Compute:
def _getUrl(self, path):
host = self._host
# IPV6
if host and ":" in host:
host = "[{}]".format(host)
if host:
# IPV6
if ":" in host:
# Reduce IPV6 to his simple form
host = str(ipaddress.IPv6Address(host))
if host == "::":
host = "::1"
host = "[{}]".format(host)
elif host == "0.0.0.0":
host = "127.0.0.1"
return "{}://{}:{}/v2/compute{}".format(self._protocol, host, self._port, path)
@asyncio.coroutine