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):
|
||||
return None
|
||||
protocol, address = tracker.split("://", 1)
|
||||
try:
|
||||
if ":" in address:
|
||||
ip, port = address.rsplit(":", 1)
|
||||
except ValueError as err:
|
||||
else:
|
||||
ip = address
|
||||
port = 80
|
||||
if protocol.startswith("https"):
|
||||
port = 443
|
||||
else:
|
||||
port = 80
|
||||
back = {}
|
||||
back["protocol"] = protocol
|
||||
back["address"] = address
|
||||
|
|
Loading…
Reference in a new issue