Browse Source

[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.
master
Sergey M․ 5 years ago
parent
commit
f7b42518dc
No known key found for this signature in database GPG Key ID: 2C393E0F18A9236D
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      youtube_dl/downloader/http.py

+ 1
- 1
youtube_dl/downloader/http.py View File

@ -299,7 +299,7 @@ class HttpFD(FileDownloader):
'elapsed': now - ctx.start_time, '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 break
if not is_test and ctx.chunk_size and ctx.data_len is not None and byte_counter < ctx.data_len: if not is_test and ctx.chunk_size and ctx.data_len is not None and byte_counter < ctx.data_len:


Loading…
Cancel
Save