mirror of https://github.com/scrapy/scrapy.git
Fix HTTP Pool key for HTTPS proxy tunneled connections (CONNECT method)
This commit is contained in:
parent
f70d538d10
commit
7d3a529dbc
|
|
@ -135,7 +135,8 @@ class TunnelingTCP4ClientEndpoint(TCP4ClientEndpoint):
|
|||
self._tunnelReadyDeferred.callback(self._protocol)
|
||||
else:
|
||||
self._tunnelReadyDeferred.errback(
|
||||
TunnelError('Could not open CONNECT tunnel.'))
|
||||
TunnelError('Could not open CONNECT tunnel with proxy %s:%s' % (
|
||||
self._host, self._port)))
|
||||
|
||||
def connectFailed(self, reason):
|
||||
"""Propagates the errback to the appropriate deferred."""
|
||||
|
|
@ -201,6 +202,14 @@ class TunnelingAgent(Agent):
|
|||
self._contextFactory, self._connectTimeout,
|
||||
self._bindAddress)
|
||||
|
||||
def _requestWithEndpoint(self, key, endpoint, method, parsedURI,
|
||||
headers, bodyProducer, requestPath):
|
||||
# proxy host and port are required for HTTP pool `key`
|
||||
# otherwise, same remote host connection request could reuse
|
||||
# a cached tunneled connection to a different proxy
|
||||
key = key + self._proxyConf
|
||||
return super(TunnelingAgent, self)._requestWithEndpoint(key, endpoint, method, parsedURI,
|
||||
headers, bodyProducer, requestPath)
|
||||
|
||||
|
||||
class ScrapyAgent(object):
|
||||
|
|
|
|||
Loading…
Reference in New Issue