Scrapy, a fast high-level web crawling & scraping framework for Python.
Don't call SSL_get_server_tmp_key() if not available (#5858)
Andrey Rakhmatullinada917307844
diff --git a/scrapy/utils/ssl.py b/scrapy/utils/ssl.pyindex f4b598ac7..3ddceea35 100644--- a/scrapy/utils/ssl.py+++ b/scrapy/utils/ssl.py@@ -20,6 +20,9 @@ def x509name_to_string(x509name):def get_temp_key_info(ssl_object):# adapted from OpenSSL apps/s_cb.c::ssl_print_tmp_key()+ if not hasattr(pyOpenSSLutil.lib, "SSL_get_server_tmp_key"):+ # removed in cryptography 40.0.0+ return Nonetemp_key_p = pyOpenSSLutil.ffi.new("EVP_PKEY **")if not pyOpenSSLutil.lib.SSL_get_server_tmp_key(ssl_object, temp_key_p):return None