Commit 531cebad authored by Georg Brandl's avatar Georg Brandl

Bug #902075: urllib2 now handles "host:port" proxy specifications


Can/should this be backported?
parent 3d563509
...@@ -579,10 +579,15 @@ class ProxyHandler(BaseHandler): ...@@ -579,10 +579,15 @@ class ProxyHandler(BaseHandler):
def proxy_open(self, req, proxy, type): def proxy_open(self, req, proxy, type):
orig_type = req.get_type() orig_type = req.get_type()
type, r_type = splittype(proxy) type, r_type = splittype(proxy)
host, XXX = splithost(r_type) if not type or r_type.isdigit():
if '@' in host: # proxy is specified without protocol
user_pass, host = host.split('@', 1) type = orig_type
if ':' in user_pass: host = proxy
else:
host, r_host = splithost(r_type)
user_pass, host = splituser(host)
user, password = splitpasswd(user_pass)
if user and password:
user, password = user_pass.split(':', 1) user, password = user_pass.split(':', 1)
user_pass = base64.encodestring('%s:%s' % (unquote(user), user_pass = base64.encodestring('%s:%s' % (unquote(user),
unquote(password))).strip() unquote(password))).strip()
......
...@@ -337,7 +337,9 @@ Extension Modules ...@@ -337,7 +337,9 @@ Extension Modules
Library Library
------- -------
- Bug #1407902: Added support for sftp:// URIs to urlparse. - Bug #902075: urllib2 now supports 'host:port' style proxy specifications.
- Bug #1407902: Add support for sftp:// URIs to urlparse.
- Bug #1371247: Update Windows locale identifiers in locale.py. - Bug #1371247: Update Windows locale identifiers in locale.py.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment