From c82f3db0986de953bf7e9529d48ecd6104895f53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 15 Nov 2024 17:59:54 +0100 Subject: [PATCH] [common] add 'proxy-env' option (#6134, #6455) disable using environment proxies by default --- docs/configuration.rst | 14 +++++++++++++- gallery_dl/extractor/common.py | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index ebbd3a0c..e830066f 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -600,10 +600,22 @@ Description ``scheme://host`` as key. See `Requests' proxy documentation`_ for more details. - Note: If a proxy URLs does not include a scheme, + Note: If a proxy URL does not include a scheme, ``http://`` is assumed. +extractor.*.proxy-env +--------------------- +Type + ``bool`` +Default + ``false`` +Description + Collect proxy configuration information from environment variables + (``HTTP_PROXY``, ``HTTPS_PROXY``, ``NO_PROXY``) + and Windows Registry settings. + + extractor.*.source-address -------------------------- Type diff --git a/gallery_dl/extractor/common.py b/gallery_dl/extractor/common.py index 61d35f41..090823e1 100644 --- a/gallery_dl/extractor/common.py +++ b/gallery_dl/extractor/common.py @@ -345,6 +345,9 @@ class Extractor(): headers.clear() ssl_options = ssl_ciphers = 0 + # .netrc Authorization headers are alwsays disabled + session.trust_env = True if self.config("proxy-env", False) else False + browser = self.config("browser") if browser is None: browser = self.browser