diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2013-04-28 15:41:05 +0200 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2013-04-28 15:41:05 +0200 |
commit | 434aca5b143fe358ae46688196391307834168fa (patch) | |
tree | b13d38f5b3907b53df77f0c21ab5b727c88bf1f8 /youtube_dl | |
parent | e31852aba934f5d53c50002ff832e290b72d8844 (diff) |
Automatically set HTTPS proxy if given (Fixes #805)
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/__init__.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index ce754ffd3..2639df818 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -376,7 +376,11 @@ def _real_main(argv=None): # General configuration cookie_processor = compat_urllib_request.HTTPCookieProcessor(jar) - proxy_handler = compat_urllib_request.ProxyHandler() + proxies = compat_urllib_request.getproxies() + # Set HTTPS proxy to HTTP one if given (https://github.com/rg3/youtube-dl/issues/805) + if 'http' in proxies and 'https' not in proxies: + proxies['https'] = proxies['http'] + proxy_handler = compat_urllib_request.ProxyHandler(proxies) opener = compat_urllib_request.build_opener(proxy_handler, cookie_processor, YoutubeDLHandler()) compat_urllib_request.install_opener(opener) socket.setdefaulttimeout(300) # 5 minutes should be enough (famous last words) |