File tree 1 file changed +8
-3
lines changed
scrapy/core/downloader/handlers 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -122,9 +122,14 @@ def processProxyResponse(self, bytes):
122
122
"""
123
123
self ._protocol .dataReceived = self ._protocolDataReceived
124
124
if TunnelingTCP4ClientEndpoint ._responseMatcher .match (bytes ):
125
- # this set proper Server Name Indication extension
126
- sslOptions = self ._contextFactory .creatorForNetloc (
127
- self ._tunneledHost , self ._tunneledPort )
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
128
133
self ._protocol .transport .startTLS (sslOptions ,
129
134
self ._protocolFactory )
130
135
self ._tunnelReadyDeferred .callback (self ._protocol )
You can’t perform that action at this time.
0 commit comments