about summary refs log tree commit diff
path: root/youtube_dl/downloader
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2020-05-05 21:30:27 +0700
committerSergey M․ <dstftw@gmail.com>2020-05-05 21:43:39 +0700
commit6c907eb33ffd79ef9c4761c6460acb31b2eded46 (patch)
tree836e1807c949b0005312c17380c8dc71d43f4db2 /youtube_dl/downloader
parentf7b42518dc4c10d6027bfe7f5e7f186d526b1a4b (diff)
downloadyoutube-dl-6c907eb33ffd79ef9c4761c6460acb31b2eded46.tar.gz
youtube-dl-6c907eb33ffd79ef9c4761c6460acb31b2eded46.tar.xz
youtube-dl-6c907eb33ffd79ef9c4761c6460acb31b2eded46.zip
[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.
Diffstat (limited to 'youtube_dl/downloader')
-rw-r--r--youtube_dl/downloader/http.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/youtube_dl/downloader/http.py b/youtube_dl/downloader/http.py
index 970103a8d..5046878df 100644
--- a/youtube_dl/downloader/http.py
+++ b/youtube_dl/downloader/http.py
@@ -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: