Apply tls_verify and tls_cacerts to ImageDownloader (#11716)

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
This commit is contained in:
Nick Touran 2024-01-08 12:14:39 -08:00 committed by GitHub
parent db9e476288
commit 2d1b94361f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -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
-------

View File

@ -75,7 +75,12 @@ class ImageDownloader(BaseImageConverter):
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))