Skip to content

Commit

Permalink
Print IPv6 url as hostname or enclosed in brackets (#652)
Browse files Browse the repository at this point in the history
  • Loading branch information
op3 authored Jan 4, 2022
1 parent 5c4441e commit db46446
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jupyter_server/serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1900,10 +1900,10 @@ def _get_urlparts(self, path=None, include_token=False):
netloc = urlencode_unix_socket_path(self.sock)
else:
# Handle nonexplicit hostname.
if self.ip in ("", "0.0.0.0"):
if self.ip in ("", "0.0.0.0", "::"):
ip = "%s" % socket.gethostname()
else:
ip = self.ip
ip = "[{}]".format(self.ip) if ":" in self.ip else self.ip
netloc = "{ip}:{port}".format(ip=ip, port=self.port)
if self.certfile:
scheme = "https"
Expand Down

0 comments on commit db46446

Please sign in to comment.