Explorar o código

[downloader/http] Request last data block of exact remaining size

Always request last data block of exact size remaining to download if possible not the current block size.
Sergey M․ %!s(int64=5) %!d(string=hai) anos
pai
achega
6c907eb33f
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      youtube_dl/downloader/http.py

+ 1 - 1
youtube_dl/downloader/http.py

@@ -227,7 +227,7 @@ class HttpFD(FileDownloader):
             while True:
                 try:
                     # Download and write
-                    data_block = ctx.data.read(block_size if not is_test else min(block_size, data_len - byte_counter))
+                    data_block = ctx.data.read(block_size if data_len is None 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: