1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-07-21 10:26:41 +00:00

[rh:requests] Refactor default headers (#13785)

Authored by: bashonly
This commit is contained in:
bashonly 2025-07-20 18:20:58 -05:00 committed by GitHub
parent 32809eb2da
commit a4561c7a66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -313,7 +313,7 @@ class RequestsRH(RequestHandler, InstanceStoreMixin):
max_retries=urllib3.util.retry.Retry(False),
)
session.adapters.clear()
session.headers = requests.models.CaseInsensitiveDict({'Connection': 'keep-alive'})
session.headers = requests.models.CaseInsensitiveDict()
session.mount('https://', http_adapter)
session.mount('http://', http_adapter)
session.cookies = cookiejar
@ -322,6 +322,7 @@ class RequestsRH(RequestHandler, InstanceStoreMixin):
def _prepare_headers(self, _, headers):
add_accept_encoding_header(headers, SUPPORTED_ENCODINGS)
headers.setdefault('Connection', 'keep-alive')
def _send(self, request):