diff options
author | mkaay <mkaay@mkaay.de> | 2010-12-19 16:07:04 +0100 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2010-12-19 16:07:04 +0100 |
commit | ae021bd9938e726b0889d1b551946810c51934a3 (patch) | |
tree | 46b9bc9fe1dcfd24be2e4f21eeff1ac1fe45cf6d /module/network/HTTPDownload.py | |
parent | little changes (diff) | |
download | pyload-ae021bd9938e726b0889d1b551946810c51934a3.tar.xz |
fixed chunk size calculation
Diffstat (limited to 'module/network/HTTPDownload.py')
-rw-r--r-- | module/network/HTTPDownload.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/module/network/HTTPDownload.py b/module/network/HTTPDownload.py index 98941ff08..4bba7724e 100644 --- a/module/network/HTTPDownload.py +++ b/module/network/HTTPDownload.py @@ -211,7 +211,7 @@ class HTTPDownload(): chunksize = size/chunks lastchunk = chunksize - chunk.range = (0, chunksize-1) + chunk.range = (0, chunksize) chunk.noRangeHeader = True self.size = chunk.size self.info.setSize(self.size) @@ -241,7 +241,6 @@ class HTTPDownload(): fh = open("%s.chunk%d" % (self.filename, i), "ab" if cont else "wb") chunk = self._createChunk(fh, range=rng) - self.chunks.append(chunk) d = chunk.download() if not chunk.resp.getcode() == 206 and i == 1: #no range supported, tell chunk0 to download everything chunk.abort = True @@ -251,6 +250,7 @@ class HTTPDownload(): self.info.clear() self.info.addChunk("%s.chunk0" % (self.filename, ), (0, self.firstchunk.size), chunk.getEncoding()) break + self.chunks.append(chunk) dg.addDeferred(d) if not self.info.loaded: @@ -284,7 +284,7 @@ if __name__ == "__main__": print "starting" dwnld = HTTPDownload(url, "test_100mb.bin") - d = dwnld.download(chunks=1, resume=True) + d = dwnld.download(chunks=2, resume=True) d.addCallback(callb) d.addErrback(err) |