diff options
author | Guido van Rossum <guido@python.org> | 1996-08-26 18:09:59 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-08-26 18:09:59 (GMT) |
commit | 78c96370755a53a296183e83fb536df2890f9195 (patch) | |
tree | fe82a101d4ab856cdb0ada0bef0569aa55bcf1cf | |
parent | dfcf35dc59d3a6d3515ab1a3511bc979143bb69a (diff) | |
download | cpython-78c96370755a53a296183e83fb536df2890f9195.zip cpython-78c96370755a53a296183e83fb536df2890f9195.tar.gz cpython-78c96370755a53a296183e83fb536df2890f9195.tar.bz2 |
Bump exposed __version__ to 1.4.
Correctly handle a URL containing user:password@host when using a proxy.
-rw-r--r-- | Lib/urllib.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py index f1756e2..621785f 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -20,7 +20,7 @@ import regex import os -__version__ = '1.3' +__version__ = '1.4' # Helper for non-unix systems if os.name == 'mac': @@ -179,15 +179,18 @@ class URLopener: import httplib if type(url) is type(""): host, selector = splithost(url) + user_passwd, host = splituser(host) else: host, selector = url + urltype, rest = splittype(selector) + if string.lower(urltype) == 'http': + realhost, rest = splithost(rest) + user_passwd, realhost = splituser(realhost) + if user_passwd: + selector = "%s://%s%s" % (urltype, + realhost, rest) print "proxy via http:", host, selector if not host: raise IOError, ('http error', 'no host given') - i = string.find(host, '@') - if i >= 0: - user_passwd, host = host[:i], host[i+1:] - else: - user_passwd = None if user_passwd: import base64 auth = string.strip(base64.encodestring(user_passwd)) |