Adds the option to omit the usage of a CONNECT tunnel by adding the noconnect

parameter to the URL of the proxy.
This commit is contained in:
duendex 2013-09-30 12:55:48 -03:00
parent 7f053cc1d2
commit 23c3288a6d
1 changed files with 3 additions and 2 deletions

View File

@ -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,