Skip to content

Commit

Permalink
[downloader/http] Finish downloading once received data length matche…
Browse files Browse the repository at this point in the history
…s 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.
  • Loading branch information
dstftw committed May 5, 2020
1 parent ce7db64 commit f7b4251
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion youtube_dl/downloader/http.py
Expand Up @@ -299,7 +299,7 @@ def retry(e):
'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:
Expand Down

0 comments on commit f7b4251

Please sign in to comment.