1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-23 19:03:59 +00:00

Remove check for pyOpenSSL>=0.16

16.2.0 is currently the minimum supported version
This commit is contained in:
Eugenio Lacuesta 2019-08-08 23:05:52 -03:00
parent fa9a9033f0
commit a940a80f58
No known key found for this signature in database
GPG Key ID: DA3EF2D0913E9810

View File

@ -30,16 +30,6 @@ openssl_methods = {
# Twisted versions because it is not used in the fallback
# ScrapyClientContextFactory.
# taken from twisted/twisted/internet/_sslverify.py
try:
# XXX: this try-except is not needed in Twisted 17.0.0+ because
# it requires pyOpenSSL 0.16+.
from OpenSSL.SSL import SSL_CB_HANDSHAKE_DONE, SSL_CB_HANDSHAKE_START
except ImportError:
SSL_CB_HANDSHAKE_START = 0x10
SSL_CB_HANDSHAKE_DONE = 0x20
try:
# XXX: this import would fail on Debian jessie with system installed
# service_identity library, due to lack of cryptography.x509 dependency
@ -73,9 +63,9 @@ class ScrapyClientTLSOptions(ClientTLSOptions):
self.verbose_logging = verbose_logging
def _identityVerifyingInfoCallback(self, connection, where, ret):
if where & SSL_CB_HANDSHAKE_START:
if where & SSL.SSL_CB_HANDSHAKE_START:
set_tlsext_host_name(connection, self._hostnameBytes)
elif where & SSL_CB_HANDSHAKE_DONE:
elif where & SSL.SSL_CB_HANDSHAKE_DONE:
if self.verbose_logging:
if hasattr(connection, 'get_cipher_name'): # requires pyOPenSSL 0.15
if hasattr(connection, 'get_protocol_version_name'): # requires pyOPenSSL 16.0.0