mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-31 06:35:12 +00:00 
			
		
		
		
	[rh:requests] Do not allocate 2GB on read (#13603)
Fixes c2ff2dbaec
Authored by: Grub4K
			
			
This commit is contained in:
		| @@ -143,7 +143,9 @@ class RequestsResponseAdapter(Response): | ||||
|             # Work around issue with `.read(amt)` then `.read()` | ||||
|             # See: https://github.com/urllib3/urllib3/issues/3636 | ||||
|             if amt is None: | ||||
|                 amt = (1 << 31) - 1 | ||||
|                 # Python 3.9 preallocates the whole read buffer, read in chunks | ||||
|                 read_chunk = functools.partial(self.fp.read, 1 << 20, decode_content=True) | ||||
|                 return b''.join(iter(read_chunk, b'')) | ||||
|             # Interact with urllib3 response directly. | ||||
|             return self.fp.read(amt, decode_content=True) | ||||
| 
 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Simon Sawicki
					Simon Sawicki