1
0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-07-03 20:42:53 -05:00

Add option --legacy-server-connect (#778)

to allow HTTPS connection to servers that do not support RFC 5746 secure renegotiation

Authored by: xtkoba
This commit is contained in:
xtkoba
2022-01-21 15:12:30 +09:00
committed by GitHub
parent 6c73052c0a
commit f81c62a6a4
4 changed files with 9 additions and 0 deletions

View File

@ -997,6 +997,8 @@ def make_HTTPS_handler(params, **kwargs):
opts_check_certificate = not params.get('nocheckcertificate')
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
context.check_hostname = opts_check_certificate
if params.get('legacyserverconnect'):
context.options |= 4 # SSL_OP_LEGACY_SERVER_CONNECT
context.verify_mode = ssl.CERT_REQUIRED if opts_check_certificate else ssl.CERT_NONE
if opts_check_certificate:
try: