protocol: catch wrong URLs ending with bare colon

This commit is contained in:
dece 2021-02-26 15:36:02 +01:00
parent ff49f0d17e
commit 9f5cae5014

View file

@ -65,7 +65,11 @@ class Request:
hostname = url_parts["host"] hostname = url_parts["host"]
if ":" in hostname: if ":" in hostname:
hostname, port = hostname.split(":", maxsplit=1) hostname, port = hostname.split(":", maxsplit=1)
try:
port = int(port) port = int(port)
except ValueError:
self.state = Request.STATE_INVALID_URL
return False
else: else:
port = 1965 port = 1965