Rev 4783: Fix proxy CONNECT for non-default ports. in file:///home/vila/src/bzr/bugs/186920-lp-proxy/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Tue Nov 3 13:46:16 GMT 2009
At file:///home/vila/src/bzr/bugs/186920-lp-proxy/
------------------------------------------------------------
revno: 4783
revision-id: v.ladeuil+lp at free.fr-20091103134616-gzloapjtw6i1btxv
parent: v.ladeuil+lp at free.fr-20091030210237-y3va20lmppu1nbzp
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 186920-lp-proxy
timestamp: Tue 2009-11-03 14:46:16 +0100
message:
Fix proxy CONNECT for non-default ports.
* bzrlib/transport/http/_urllib2_wrappers.py:
(Request.set_proxy): The port is embedded in the host attribute,
but it can be set.
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2009-10-30 15:15:32 +0000
+++ b/NEWS 2009-11-03 13:46:16 +0000
@@ -37,7 +37,7 @@
(Andrew Bennetts, #437626)
* Launchpad urls can now be resolved from behind proxies.
- (Gordon Tyler, Vincent Ladeuil, #198920)
+ (Gordon Tyler, Vincent Ladeuil, #186920)
* PreviewTree file names are not limited by the encoding of the temp
directory's filesystem. (Aaron Bentley, #436794)
=== modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
--- a/bzrlib/transport/http/_urllib2_wrappers.py 2009-10-30 21:02:37 +0000
+++ b/bzrlib/transport/http/_urllib2_wrappers.py 2009-11-03 13:46:16 +0000
@@ -366,13 +366,16 @@
def set_proxy(self, proxy, type):
"""Set the proxy and remember the proxied host."""
- # We need to set the default port ourselves way before it gets set
- # in the HTTP[S]Connection object at build time.
- if self.type == 'https':
- conn_class = HTTPSConnection
- else:
- conn_class = HTTPConnection
- self.proxied_host = '%s:%s' % (self.get_host(), conn_class.default_port)
+ host, port = urllib.splitport(self.get_host())
+ if port is None:
+ # We need to set the default port ourselves way before it gets set
+ # in the HTTP[S]Connection object at build time.
+ if self.type == 'https':
+ conn_class = HTTPSConnection
+ else:
+ conn_class = HTTPConnection
+ port = conn_class.default_port
+ self.proxied_host = '%s:%s' % (host, port)
urllib2.Request.set_proxy(self, proxy, type)
More information about the bazaar-commits
mailing list