From fe24c56e84e1dcbcb5577f6162ba14c0c36d639c Mon Sep 17 00:00:00 2001 From: calvin Date: Tue, 3 Jan 2006 18:37:42 +0000 Subject: [PATCH] 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 --- linkcheck/url.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/linkcheck/url.py b/linkcheck/url.py index 00168297..be402f36 100644 --- a/linkcheck/url.py +++ b/linkcheck/url.py @@ -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):