File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
scrapy/core/downloader/handlers Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -122,7 +122,15 @@ def processProxyResponse(self, bytes):
122
122
"""
123
123
self ._protocol .dataReceived = self ._protocolDataReceived
124
124
if TunnelingTCP4ClientEndpoint ._responseMatcher .match (bytes ):
125
- self ._protocol .transport .startTLS (self ._contextFactory ,
125
+ try :
126
+ # this sets proper Server Name Indication extension
127
+ # but is only available for Twisted>=14.0
128
+ sslOptions = self ._contextFactory .creatorForNetloc (
129
+ self ._tunneledHost , self ._tunneledPort )
130
+ except AttributeError :
131
+ # fall back to non-SNI SSL context factory
132
+ sslOptions = self ._contextFactory
133
+ self ._protocol .transport .startTLS (sslOptions ,
126
134
self ._protocolFactory )
127
135
self ._tunnelReadyDeferred .callback (self ._protocol )
128
136
else :
You can’t perform that action at this time.
0 commit comments