diff options
author | Guido van Rossum <guido@python.org> | 1998-04-27 15:19:17 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-04-27 15:19:17 (GMT) |
commit | 0eae8fba8172f947a4c66d9e961a74767271e05d (patch) | |
tree | 94b15112adc7122ac95c2e607ecf72a5faf800f2 /Lib | |
parent | d0ddb66c840b740d30925dee75d953af5761b4c6 (diff) | |
download | cpython-0eae8fba8172f947a4c66d9e961a74767271e05d.zip cpython-0eae8fba8172f947a4c66d9e961a74767271e05d.tar.gz cpython-0eae8fba8172f947a4c66d9e961a74767271e05d.tar.bz2 |
Feeble attempt at making urlopen more robust -- don't call splituser()
when splithost() returned no useable host, to avoid calling
splituser() on None.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/urllib.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py index 8a47316..1f110c0 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -214,9 +214,11 @@ class URLopener: # Use HTTP protocol def open_http(self, url, data=None): import httplib + user_passwd = None if type(url) is type(""): host, selector = splithost(url) - user_passwd, host = splituser(host) + if host: + user_passwd, host = splituser(host) realhost = host else: host, selector = url @@ -226,7 +228,9 @@ class URLopener: realhost = None else: realhost, rest = splithost(rest) - user_passwd, realhost = splituser(realhost) + if realhost: + user_passwd, realhost = \ + splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, |