Skip to content

Commit

Permalink
[common] add 'proxy-env' option
Browse files Browse the repository at this point in the history
(#6134, #6455)
disable using environment proxies by default
  • Loading branch information
mikf committed Nov 15, 2024
1 parent 0a72a50 commit c82f3db
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 13 additions & 1 deletion docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions gallery_dl/extractor/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@ def _init_session(self):
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
Expand Down

0 comments on commit c82f3db

Please sign in to comment.