[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.
pull/25201/head^2
Sergey M․ 2020-05-05 21:30:27 +07:00
parent f7b42518dc
commit 6c907eb33f
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D
1 changed files with 1 additions and 1 deletions

View File

@ -227,7 +227,7 @@ class HttpFD(FileDownloader):
while True: while True:
try: try:
# Download and write # 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 # socket.timeout is a subclass of socket.error but may not have
# errno set # errno set
except socket.timeout as e: except socket.timeout as e: