aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2023-07-04 18:46:32 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2023-07-06 20:22:00 +0530
commit662ef1e910b72e57957f06589925b2332ba52821 (patch)
tree7a8a84d76767db77d4d7f7280eadbac77d2a5c86
parent6355b5f1e1e8e7f4ef866d71d51e03baf0e82f17 (diff)
downloadhypervideo-pre-662ef1e910b72e57957f06589925b2332ba52821.tar.lz
hypervideo-pre-662ef1e910b72e57957f06589925b2332ba52821.tar.xz
hypervideo-pre-662ef1e910b72e57957f06589925b2332ba52821.zip
[downloader/http] Avoid infinite loop when no data is received
Closes #7504
-rw-r--r--yt_dlp/downloader/http.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/yt_dlp/downloader/http.py b/yt_dlp/downloader/http.py
index e785f0d4e..7c5daea85 100644
--- a/yt_dlp/downloader/http.py
+++ b/yt_dlp/downloader/http.py
@@ -339,15 +339,15 @@ class HttpFD(FileDownloader):
elif speed:
ctx.throttle_start = None
- if not is_test and ctx.chunk_size and ctx.content_len is not None and byte_counter < ctx.content_len:
- ctx.resume_len = byte_counter
- # ctx.block_size = block_size
- raise NextFragment()
-
if ctx.stream is None:
self.to_stderr('\n')
self.report_error('Did not get any data blocks')
return False
+
+ if not is_test and ctx.chunk_size and ctx.content_len is not None and byte_counter < ctx.content_len:
+ ctx.resume_len = byte_counter
+ raise NextFragment()
+
if ctx.tmpfilename != '-':
ctx.stream.close()