You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am unsure this is intentional but the calculation of the url field in the configuration file of the ServerApp changed between 1.8 -> 1.11.*. We noticed this doing an upgrade which broke some existing functionality on our end.
In 1.8, the calculation of this value was:
@propertydefconnection_url(self):
ip=self.ipifself.ipelse'localhost'returnself.get_url(ip=ip, path=self.base_url)
defget_url(self, ip=None, path=None, token=None):
"""Build a url for the application with reasonable defaults."""ifnotip:
ip=self.ipifself.ipelse'localhost'ifnotpath:
path=self.default_url# Build query string.iftoken:
token=urllib.parse.urlencode({'token': token})
# Build the URL Parts to dump.urlparts=urllib.parse.ParseResult(
scheme='https'ifself.certfileelse'http',
netloc="{ip}:{port}".format(ip=ip, port=self.port),
path=path,
params=None,
query=token,
fragment=None
)
returnurlparts.geturl()
In 1.11 the calculation is:
@propertydefconnection_url(self):
urlparts=self._get_urlparts(path=self.base_url)
returnurlparts.geturl()
def_get_urlparts(self, path=None, include_token=False):
"""Constructs a urllib named tuple, ParseResult, with default values set by server config. The returned tuple can be manipulated using the `_replace` method. """ifself.sock:
scheme="http+unix"netloc=urlencode_unix_socket_path(self.sock)
else:
# Handle nonexplicit hostname.ifself.ipin ("", "0.0.0.0", "::"):
ip="%s"%socket.gethostname()
else:
ip="[{}]".format(self.ip) if":"inself.ipelseself.ipnetloc="{ip}:{port}".format(ip=ip, port=self.port)
ifself.certfile:
scheme="https"else:
scheme="http"ifnotpath:
path=self.default_urlquery=Noneifinclude_token:
ifself.token: # Don't log full token if it came from configtoken=self.tokenifself._token_generatedelse"..."query=urllib.parse.urlencode({"token": token})
# Build the URL Parts to dump.urlparts=urllib.parse.ParseResult(
scheme=scheme,
netloc=netloc,
path=path,
params=None,
query=query,
fragment=None,
)
returnurlparts
The main condition I want to point out is related to the value of self.ip. In the earlier version, if the value was False such as an empty string (""), the calculation resolves the ip to localhost. In the later version, if the value was False such as an empty string (""), the calculation would resolve the ip to socket.gethostname() which in our case running this server in a K8's cluster, took on a different value than localhost. This overall results in a different value of the url field in the ServerApp configuration.
If this is a truly a regression, I am happy to submit a request to fix the issue at hand. Otherwise please ignore and resolve the issue.
The text was updated successfully, but these errors were encountered:
Description
I am unsure this is intentional but the calculation of the
url
field in the configuration file of theServerApp
changed between 1.8 -> 1.11.*. We noticed this doing an upgrade which broke some existing functionality on our end.In 1.8, the calculation of this value was:
In 1.11 the calculation is:
The main condition I want to point out is related to the value of
self.ip
. In the earlier version, if the value was False such as an empty string (""
), the calculation resolves the ip tolocalhost
. In the later version, if the value was False such as an empty string (""
), the calculation would resolve the ip tosocket.gethostname()
which in our case running this server in a K8's cluster, took on a different value thanlocalhost
. This overall results in a different value of theurl
field in theServerApp
configuration.If this is a truly a regression, I am happy to submit a request to fix the issue at hand. Otherwise please ignore and resolve the issue.
The text was updated successfully, but these errors were encountered: