From 0b2bb3bc7a9f16b67339809000af14d39e444b6c Mon Sep 17 00:00:00 2001 From: Paul Tremberth Date: Tue, 23 Feb 2016 16:28:48 +0100 Subject: [PATCH] Revert "[MRG+1] Cleanup http11 tunneling connection after #1678" --- scrapy/core/downloader/handlers/http11.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scrapy/core/downloader/handlers/http11.py b/scrapy/core/downloader/handlers/http11.py index ad3285a32..a4d5a28c8 100644 --- a/scrapy/core/downloader/handlers/http11.py +++ b/scrapy/core/downloader/handlers/http11.py @@ -92,9 +92,11 @@ class TunnelingTCP4ClientEndpoint(TCP4ClientEndpoint): def requestTunnel(self, protocol): """Asks the proxy to open a tunnel.""" - tunnelReq = to_bytes( - 'CONNECT %s:%s HTTP/1.1\r\n' % ( - self._tunneledHost, self._tunneledPort), encoding='ascii') + tunnelReq = ( + b'CONNECT ' + + to_bytes(self._tunneledHost, encoding='ascii') + b':' + + to_bytes(str(self._tunneledPort)) + + b' HTTP/1.1\r\n') if self._proxyAuthHeader: tunnelReq += \ b'Proxy-Authorization: ' + self._proxyAuthHeader + b'\r\n'