summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPhilipp Hagemeister <[email protected]>2015-01-15 02:06:48 +0100
committerPhilipp Hagemeister <[email protected]>2015-01-15 02:06:50 +0100
commitbe5f2c192cde200b6fcc8d754fde8b5e479a300c (patch)
tree10b7e22a167565792407665eea1a8b3f29dad8e8
parentc9ef44ce296ded2d5ba4b36ad60b0a7add7944bd (diff)
downloadyoutube-dl-be5f2c192cde200b6fcc8d754fde8b5e479a300c.tar.gz
youtube-dl-be5f2c192cde200b6fcc8d754fde8b5e479a300c.zip
[ssl] Correct connect creation
We want to authenticate the server, see https://docs.python.org/dev/library/ssl.html#ssl.Purpose.SERVER_AUTH .
-rw-r--r--youtube_dl/utils.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 38c18c127..2546fa45d 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -399,8 +399,9 @@ def formatSeconds(secs):
def make_HTTPS_handler(params, **kwargs):
opts_no_check_certificate = params.get('nocheckcertificate', False)
if hasattr(ssl, 'create_default_context'): # Python >= 3.4 or 2.7.9
- context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
+ context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
if opts_no_check_certificate:
+ context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
try:
return YoutubeDLHTTPSHandler(params, context=context, **kwargs)