1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-10-31 06:35:12 +00:00

[rh:requests] Work around partial read dropping data (#13599)

Authored by: Grub4K
This commit is contained in:
Simon Sawicki
2025-07-02 00:12:43 +02:00
committed by GitHub
parent ca5cce5b07
commit c2ff2dbaec
2 changed files with 16 additions and 5 deletions

View File

@@ -140,6 +140,10 @@ class RequestsResponseAdapter(Response):
def read(self, amt: int | None = None):
try:
# Work around issue with `.read(amt)` then `.read()`
# See: https://github.com/urllib3/urllib3/issues/3636
if amt is None:
amt = (1 << 31) - 1
# Interact with urllib3 response directly.
return self.fp.read(amt, decode_content=True)