]> jfr.im git - yt-dlp.git/commitdiff
[downloader/http] Avoid infinite loop when no data is received
authorpukkandan <redacted>
Tue, 4 Jul 2023 13:16:32 +0000 (18:46 +0530)
committerpukkandan <redacted>
Thu, 6 Jul 2023 14:52:00 +0000 (20:22 +0530)
Closes #7504

yt_dlp/downloader/http.py

index e785f0d4edadb85af85cada38bb7990d6c2db199..7c5daea8592339771965bda83fa6b6193b59207c 100644 (file)
@@ -339,15 +339,15 @@ def retry(e):
                 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()