From 23c3288a6d07834687f607ac95ce5c082f061bfa Mon Sep 17 00:00:00 2001 From: duendex Date: Mon, 30 Sep 2013 12:55:48 -0300 Subject: [PATCH] Adds the option to omit the usage of a CONNECT tunnel by adding the noconnect parameter to the URL of the proxy. --- scrapy/core/downloader/handlers/http11.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scrapy/core/downloader/handlers/http11.py b/scrapy/core/downloader/handlers/http11.py index 0187b6f3c..1985e1251 100644 --- a/scrapy/core/downloader/handlers/http11.py +++ b/scrapy/core/downloader/handlers/http11.py @@ -138,9 +138,10 @@ class ScrapyAgent(object): bindaddress = request.meta.get('bindaddress') or self._bindAddress proxy = request.meta.get('proxy') if proxy: - _, _, proxyHost, proxyPort, _ = _parse(proxy) + _, _, proxyHost, proxyPort, proxyParams = _parse(proxy) scheme = _parse(request.url)[0] - if scheme == 'https': + skipConnectTunnel = proxyParams.find('noconnect') >= 0 + if scheme == 'https' and not skipConnectTunnel: proxyConf = (proxyHost, proxyPort, request.headers.get('Proxy-Authorization', None)) return self._TunnelingAgent(reactor, proxyConf,