Set OP_LEGACY_SERVER_CONNECT to support some old servers when using OpenSSL 3.

This commit is contained in:
Andrey Rakhmatullin 2023-01-13 20:46:55 +04:00
parent 93ad6a4bc2
commit fb52918d23
1 changed files with 3 additions and 1 deletions

View File

@ -61,7 +61,9 @@ class ScrapyClientContextFactory(BrowserLikePolicyForHTTPS):
# kept for old-style HTTP/1.0 downloader context twisted calls,
# e.g. connectSSL()
def getContext(self, hostname=None, port=None):
return self.getCertificateOptions().getContext()
ctx = self.getCertificateOptions().getContext()
ctx.set_options(0x4) # OP_LEGACY_SERVER_CONNECT
return ctx
def creatorForNetloc(self, hostname, port):
return ScrapyClientTLSOptions(hostname.decode("ascii"), self.getContext(),