From b46fab5608c9199f5336ed3a851e59b084dde842 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 3 Jul 2019 12:29:02 +0200 Subject: 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. --- websockify/token_plugins.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'websockify') 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 -- cgit v1.2.1