use 'Content-Length' to determine incomplete downloads (#29)

This commit is contained in:
Mike Fährmann
2017-10-20 18:56:18 +02:00
parent 16783e327f
commit 2e982f56af
2 changed files with 21 additions and 2 deletions

View File

@@ -255,6 +255,7 @@ class TestJob(DownloadJob):
def __init__(self, hashobj):
self.hashobj = hashobj
self.path = ""
self.size = 0
self.has_extension = True
def __enter__(self):
@@ -264,12 +265,17 @@ class TestJob(DownloadJob):
pass
def open(self):
self.size = 0
return self
def write(self, content):
"""Update SHA1 hash"""
self.size += len(content)
self.hashobj.update(content)
def tell(self):
return self.size
def __init__(self, url, parent=None, content=False):
DownloadJob.__init__(self, url, parent)
self.content = content