launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27268
[Merge] ~cjwatson/launchpad:py3-mirror-prober-https-proxy into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-mirror-prober-https-proxy into launchpad:master.
Commit message:
Fix mirror prober HTTPS proxy handling on Python 3
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1935999 in Launchpad itself: "Mirror prober "Data must not be unicode" error"
https://bugs.launchpad.net/launchpad/+bug/1935999
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/405688
Unfortunately this doesn't seem to have useful unit test coverage; I suspect it was too hard to get going at the time and we skipped it. Since this is a production regression I want to get it fixed ASAP, so I've just tested this manually on dogfood.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-mirror-prober-https-proxy into launchpad:master.
diff --git a/lib/lp/services/httpproxy/connect_tunneling.py b/lib/lp/services/httpproxy/connect_tunneling.py
index 59a542c..8470c63 100644
--- a/lib/lp/services/httpproxy/connect_tunneling.py
+++ b/lib/lp/services/httpproxy/connect_tunneling.py
@@ -29,7 +29,7 @@ class TunnelingTCP4ClientEndpoint(TCP4ClientEndpoint):
To accomplish that, this endpoint sends an HTTP CONNECT to the proxy.
"""
- _responseMatcher = re.compile(r'HTTP/1\.. 200')
+ _responseMatcher = re.compile(br'HTTP/1\.. 200')
def __init__(self, reactor, host, port, proxyConf, contextFactory,
timeout=30, bindAddress=None):
@@ -45,11 +45,11 @@ class TunnelingTCP4ClientEndpoint(TCP4ClientEndpoint):
def requestTunnel(self, protocol):
"""Asks the proxy to open a tunnel."""
- tunnelReq = 'CONNECT %s:%s HTTP/1.1\n' % (self._tunneledHost,
- self._tunneledPort)
+ tunnelReq = b'CONNECT %s:%d HTTP/1.1\n' % (self._tunneledHost,
+ self._tunneledPort)
if self._proxyAuthHeader:
- tunnelReq += 'Proxy-Authorization: %s\n' % self._proxyAuthHeader
- tunnelReq += '\n'
+ tunnelReq += b'Proxy-Authorization: %s\n' % self._proxyAuthHeader
+ tunnelReq += b'\n'
protocol.transport.write(tunnelReq)
self._protocolDataReceived = protocol.dataReceived
protocol.dataReceived = self.processProxyResponse