protocol: catch wrong URLs ending with bare colon
This commit is contained in:
parent
ff49f0d17e
commit
9f5cae5014
|
@ -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)
|
||||||
port = int(port)
|
try:
|
||||||
|
port = int(port)
|
||||||
|
except ValueError:
|
||||||
|
self.state = Request.STATE_INVALID_URL
|
||||||
|
return False
|
||||||
else:
|
else:
|
||||||
port = 1965
|
port = 1965
|
||||||
|
|
||||||
|
|
Reference in a new issue