diff options
author | Pierre Ossman <ossman@cendio.se> | 2019-07-03 12:29:02 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2019-07-03 12:29:02 +0200 |
commit | b46fab5608c9199f5336ed3a851e59b084dde842 (patch) | |
tree | 36a602d688b4d0b2d3ac37c0cfc73ccffaec06c5 /websockify | |
parent | 6a268a09b668915d6b0e2cd2df1b5425fce1ab92 (diff) | |
download | websockify-b46fab5608c9199f5336ed3a851e59b084dde842.tar.gz |
Make sure the port is a simple string
getaddrinfo() gladly allows unicode for the host, but the port must
be in ascii (e.g. "https"). Make sure this is properly converted
before we pass it on.
Patch by @caderize on GitHub.
Diffstat (limited to 'websockify')
-rw-r--r-- | websockify/token_plugins.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/websockify/token_plugins.py b/websockify/token_plugins.py index 84bda93..03800e7 100644 --- a/websockify/token_plugins.py +++ b/websockify/token_plugins.py @@ -65,10 +65,12 @@ class BaseTokenAPI(BasePlugin): # should go # we import things on demand so that other plugins - # in this file can be used w/o unecessary dependencies + # in this file can be used w/o unnecessary dependencies def process_result(self, resp): - return resp.text.split(':') + host, port = resp.text.split(':') + port = port.encode('ascii','ignore') + return [ host, port ] def lookup(self, token): import requests |