1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-12-24 23:37:55 +01:00

[downloader/http] Request last data block of exact remaining size

Always request last data block of exact size remaining to download if possible not the current block size.
This commit is contained in:
Sergey M․ 2020-05-05 21:30:27 +07:00 committed by tsia
parent d66aed88bf
commit 41c1621f26

View File

@ -227,7 +227,7 @@ class HttpFD(FileDownloader):
while True:
try:
# Download and write
data_block = ctx.data.read(block_size if not is_test else min(block_size, data_len - byte_counter))
data_block = ctx.data.read(block_size if data_len is None else min(block_size, data_len - byte_counter))
# socket.timeout is a subclass of socket.error but may not have
# errno set
except socket.timeout as e: