Skip to content

Commit db46446

Browse files
authored
Print IPv6 url as hostname or enclosed in brackets (#652)
1 parent 5c4441e commit db46446

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

jupyter_server/serverapp.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1900,10 +1900,10 @@ def _get_urlparts(self, path=None, include_token=False):
19001900
netloc = urlencode_unix_socket_path(self.sock)
19011901
else:
19021902
# Handle nonexplicit hostname.
1903-
if self.ip in ("", "0.0.0.0"):
1903+
if self.ip in ("", "0.0.0.0", "::"):
19041904
ip = "%s" % socket.gethostname()
19051905
else:
1906-
ip = self.ip
1906+
ip = "[{}]".format(self.ip) if ":" in self.ip else self.ip
19071907
netloc = "{ip}:{port}".format(ip=ip, port=self.port)
19081908
if self.certfile:
19091909
scheme = "https"

0 commit comments

Comments
 (0)