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.
This commit is contained in:
Pierre Ossman 2019-07-03 12:29:02 +02:00
parent 6a268a09b6
commit b46fab5608
1 changed files with 4 additions and 2 deletions

View File

@ -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