mirror of https://github.com/scrapy/scrapy.git
Merge pull request #1942 from scrapy/backport-1.1-pr1938
[backport][1.1] Set SNI properly when using CONNECT (PR #1938)
This commit is contained in:
commit
f70d538d10
|
|
@ -122,7 +122,15 @@ class TunnelingTCP4ClientEndpoint(TCP4ClientEndpoint):
|
|||
"""
|
||||
self._protocol.dataReceived = self._protocolDataReceived
|
||||
if TunnelingTCP4ClientEndpoint._responseMatcher.match(bytes):
|
||||
self._protocol.transport.startTLS(self._contextFactory,
|
||||
try:
|
||||
# this sets proper Server Name Indication extension
|
||||
# but is only available for Twisted>=14.0
|
||||
sslOptions = self._contextFactory.creatorForNetloc(
|
||||
self._tunneledHost, self._tunneledPort)
|
||||
except AttributeError:
|
||||
# fall back to non-SNI SSL context factory
|
||||
sslOptions = self._contextFactory
|
||||
self._protocol.transport.startTLS(sslOptions,
|
||||
self._protocolFactory)
|
||||
self._tunnelReadyDeferred.callback(self._protocol)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue