Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ Bugs fixed
* #11675: Fix rendering of progression bars in environments that do not support
ANSI control sequences.
Patch by Bénédikt Tran.
* #11715: Apply ``tls_verify`` and ``tls_cacerts`` config to
``ImageDownloader``.
Patch by Nick Touran.

Testing
-------
Expand Down
7 changes: 6 additions & 1 deletion sphinx/transforms/post_transforms/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ def handle(self, node: nodes.image) -> None:
timestamp: float = ceil(os.stat(path).st_mtime)
headers['If-Modified-Since'] = epoch_to_rfc1123(timestamp)

r = requests.get(node['uri'], headers=headers)
config = self.app.config
r = requests.get(
node['uri'], headers=headers,
_user_agent=config.user_agent,
_tls_info=(config.tls_verify, config.tls_cacerts),
)
if r.status_code >= 400:
logger.warning(__('Could not fetch remote image: %s [%d]') %
(node['uri'], r.status_code))
Expand Down