aboutsummaryrefslogtreecommitdiffhomepage
path: root/youtube_dl/downloader
diff options
context:
space:
mode:
authorSergey M․ <[email protected]>2020-05-05 20:01:25 +0700
committerSergey M․ <[email protected]>2020-05-05 21:43:39 +0700
commitf7b42518dc4c10d6027bfe7f5e7f186d526b1a4b (patch)
treee28ff67055c564bb34014a4e93c99b4d32478299 /youtube_dl/downloader
parentce7db64bf1a558759be63e92f34550d7ba0e4052 (diff)
downloadyoutube-dl-f7b42518dc4c10d6027bfe7f5e7f186d526b1a4b.tar.gz
youtube-dl-f7b42518dc4c10d6027bfe7f5e7f186d526b1a4b.zip
[downloader/http] Finish downloading once received data length matches expected
Always do this if possible, i.e. if Content-Length or expected length is known, not only in test. This will save unnecessary last extra loop trying to read 0 bytes.
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 3c72ea18b..970103a8d 100644
--- a/youtube_dl/downloader/http.py
+++ b/youtube_dl/downloader/http.py
@@ -299,7 +299,7 @@ class HttpFD(FileDownloader):
'elapsed': now - ctx.start_time,
})
- if is_test and byte_counter == data_len:
+ if data_len is not None and byte_counter == data_len:
break
if not is_test and ctx.chunk_size and ctx.data_len is not None and byte_counter < ctx.data_len: