Scrapy, a fast high-level web crawling & scraping framework for Python.
Add warning for context factories not accepting `method` param
Paul Tremberthc9890d5f7662
diff --git a/scrapy/core/downloader/handlers/http11.py b/scrapy/core/downloader/handlers/http11.pyindex 522bac16f..1fe31b206 100644--- a/scrapy/core/downloader/handlers/http11.py+++ b/scrapy/core/downloader/handlers/http11.py@@ -4,6 +4,7 @@ import reimport loggingfrom io import BytesIOfrom time import time+import warningsfrom six.moves.urllib.parse import urldefragfrom zope.interface import implementer@@ -18,7 +19,7 @@ from scrapy.xlib.tx import Agent, ProxyAgent, ResponseDone, \from scrapy.http import Headersfrom scrapy.responsetypes import responsetypesfrom scrapy.core.downloader.webclient import _parse-from scrapy.core.downloader.tls import openssl_methods, METHOD_TLS+from scrapy.core.downloader.tls import openssl_methodsfrom scrapy.utils.misc import load_objectfrom scrapy.utils.python import to_bytes, to_unicodefrom scrapy import twisted_version@@ -39,9 +40,12 @@ class HTTP11DownloadHandler(object):try:self._contextFactory = self._contextFactoryClass(method=self._sslMethod)except TypeError:- # use defaults+ # use context factory defaultsself._contextFactory = self._contextFactoryClass()-+ warnings.warn("""+ You are using a context factory class that does not accept the `method` argument+ (type OpenSSL.SSL method, e.g. OpenSSL.SSL.SSLv23_METHOD).+ Please upgrade your context factory class to handle or ignore it.""")self._default_maxsize = settings.getint('DOWNLOAD_MAXSIZE')self._default_warnsize = settings.getint('DOWNLOAD_WARNSIZE')self._disconnect_timeout = 1