summaryrefslogtreecommitdiff
path: root/sphinx/util/requests.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/util/requests.py')
-rw-r--r--sphinx/util/requests.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/sphinx/util/requests.py b/sphinx/util/requests.py
index d9d1d1b2c..8ae435d41 100644
--- a/sphinx/util/requests.py
+++ b/sphinx/util/requests.py
@@ -4,7 +4,7 @@
Simple requests package loader
- :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
+ :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -18,6 +18,7 @@ import requests
import sphinx
from sphinx.config import Config
+from sphinx.deprecation import RemovedInSphinx50Warning
try:
from requests.packages.urllib3.exceptions import SSLError
@@ -43,6 +44,10 @@ useragent_header = [('User-Agent',
def is_ssl_error(exc: Exception) -> bool:
"""Check an exception is SSLError."""
+ warnings.warn(
+ "is_ssl_error() is outdated and likely returns incorrect results "
+ "for modern versions of Requests.",
+ RemovedInSphinx50Warning)
if isinstance(exc, SSLError):
return True
else:
@@ -124,4 +129,4 @@ def head(url: str, **kwargs: Any) -> requests.Response:
headers.setdefault('User-Agent', useragent_header[0][1])
with ignore_insecure_warning(**kwargs):
- return requests.get(url, **kwargs)
+ return requests.head(url, **kwargs)