Use if in protocol port detection
This commit is contained in:
parent
6d2a863af5
commit
16f29b65f2
1 changed files with 4 additions and 3 deletions
|
@ -171,13 +171,14 @@ class SiteAnnouncer(object):
|
||||||
if "://" not in tracker or not re.match("^[A-Za-z0-9:/\\.#-]+$", tracker):
|
if "://" not in tracker or not re.match("^[A-Za-z0-9:/\\.#-]+$", tracker):
|
||||||
return None
|
return None
|
||||||
protocol, address = tracker.split("://", 1)
|
protocol, address = tracker.split("://", 1)
|
||||||
try:
|
if ":" in address:
|
||||||
ip, port = address.rsplit(":", 1)
|
ip, port = address.rsplit(":", 1)
|
||||||
except ValueError as err:
|
else:
|
||||||
ip = address
|
ip = address
|
||||||
port = 80
|
|
||||||
if protocol.startswith("https"):
|
if protocol.startswith("https"):
|
||||||
port = 443
|
port = 443
|
||||||
|
else:
|
||||||
|
port = 80
|
||||||
back = {}
|
back = {}
|
||||||
back["protocol"] = protocol
|
back["protocol"] = protocol
|
||||||
back["address"] = address
|
back["address"] = address
|
||||||
|
|
Loading…
Reference in a new issue