Merge pull request #1921 from rllola/tracker-announcer

If no port defined in tracker url assume it is port 80
This commit is contained in:
ZeroNet 2019-03-10 23:42:07 +01:00 committed by GitHub
commit 116347ef66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -172,7 +172,13 @@ class SiteAnnouncer(object):
if "://" not in tracker or not re.match("^[A-Za-z0-9:/\\.#-]+$", tracker):
return None
protocol, address = tracker.split("://", 1)
ip, port = address.rsplit(":", 1)
try:
ip, port = address.rsplit(":", 1)
except ValueError as err:
ip = address
port = 80
if protocol.startswith("https"):
port = 443
back = {}
back["protocol"] = protocol
back["address"] = address