mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-19 12:01:07 +00:00
only split host ports on known schemes
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3009 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
da6bde5d8d
commit
fe24c56e84
1 changed files with 8 additions and 12 deletions
|
|
@ -212,18 +212,14 @@ def url_fix_host (urlparts):
|
|||
userpass += "@"
|
||||
else:
|
||||
userpass = ""
|
||||
dport = default_ports.get(urlparts[0], 80)
|
||||
newhost, port = splitport(host, port=dport)
|
||||
if port is not None:
|
||||
host = newhost
|
||||
# remove trailing dot
|
||||
if host.endswith("."):
|
||||
host = host[:-1]
|
||||
if port == dport:
|
||||
# a default port
|
||||
urlparts[1] = userpass+host
|
||||
else:
|
||||
urlparts[1] = "%s%s:%d" % (userpass, host, port)
|
||||
if urlparts[0] in default_ports:
|
||||
dport = default_ports[urlparts[0]]
|
||||
host, port = splitport(host, port=dport)
|
||||
if host.endswith("."):
|
||||
host = host[:-1]
|
||||
if port != dport:
|
||||
host = "%s:%d" % (host, port)
|
||||
urlparts[1] = userpass+host
|
||||
|
||||
|
||||
def url_fix_common_typos (url):
|
||||
|
|
|
|||
Loading…
Reference in a new issue