aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix S <felix.von.s@posteo.de>2021-08-11 15:39:17 +0000
committerGitHub <noreply@github.com>2021-08-11 21:09:17 +0530
commit0715f7e19b4f7e7b423f1fb3a8348fbc85bb82fb (patch)
tree151ce49c7e3579950c11e526f9b3c49d9aba66f5
parenta8731fcc1d11afe0c6c3e349d0c85d32ed17488a (diff)
downloadhypervideo-pre-0715f7e19b4f7e7b423f1fb3a8348fbc85bb82fb.tar.lz
hypervideo-pre-0715f7e19b4f7e7b423f1fb3a8348fbc85bb82fb.tar.xz
hypervideo-pre-0715f7e19b4f7e7b423f1fb3a8348fbc85bb82fb.zip
Revert erroneous use of the `Content-Length` header (#637)
This reverts commit 6c907eb33ffd79ef9c4761c6460acb31b2eded46 The use of the Content-Length value here is erroneous and may lead to truncated downloads if a compression scheme is specified in the Content-Encoding header, as the Content-Length header refers to the size of encoded data, not of the raw bytestream. This has been noticed in the wild with WebVTT subtitle segments. Authored by: fstirlitz
-rw-r--r--yt_dlp/downloader/http.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/yt_dlp/downloader/http.py b/yt_dlp/downloader/http.py
index 9830f9e27..1edb0f91f 100644
--- a/yt_dlp/downloader/http.py
+++ b/yt_dlp/downloader/http.py
@@ -238,7 +238,7 @@ class HttpFD(FileDownloader):
while True:
try:
# Download and write
- data_block = ctx.data.read(block_size if data_len is None else min(block_size, data_len - byte_counter))
+ data_block = ctx.data.read(block_size if not is_test 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: