summaryrefslogtreecommitdiffstats
path: root/module/network
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2010-12-19 19:04:00 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2010-12-19 19:04:00 +0100
commit9c167aafc389111398dbd5e1c50bdeff24afea9e (patch)
tree4b4feaafd10566a5ba354d7eba11ac09eb268948 /module/network
parentcalc fixes (diff)
downloadpyload-9c167aafc389111398dbd5e1c50bdeff24afea9e.tar.xz
corrected byte range on resume
Diffstat (limited to 'module/network')
-rw-r--r--module/network/HTTPDownload.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/module/network/HTTPDownload.py b/module/network/HTTPDownload.py
index fbec872fa..fed99ae23 100644
--- a/module/network/HTTPDownload.py
+++ b/module/network/HTTPDownload.py
@@ -200,7 +200,7 @@ class HTTPDownload():
if resume:
if self.info.getCount() == chunks and exists("%s.chunk0" % (self.filename, )):
crange = self.info.getChunkRange(0)
- crange = (crange[0]+getsize("%s.chunk0" % (self.filename, )), crange[1])
+ crange = (crange[0]+getsize("%s.chunk0" % (self.filename, )), crange[1]-1)
if crange is None or crange[1]-crange[0] > 0:
fh = open("%s.chunk0" % (self.filename, ), "ab" if crange else "wb")
@@ -271,10 +271,10 @@ if __name__ == "__main__":
import sys
from Bucket import Bucket
bucket = Bucket()
- #bucket.setRate(200*1000)
- bucket = None
+ bucket.setRate(200*1024)
+ #bucket = None
- url = "http://speedtest.netcologne.de/test_100mb.bin"
+ url = "http://speedtest.netcologne.de/test_10mb.bin"
finished = False
def err(*a, **b):
@@ -286,7 +286,7 @@ if __name__ == "__main__":
print "starting"
- dwnld = HTTPDownload(url, "test_100mb.bin")
+ dwnld = HTTPDownload(url, "test_10mb.bin", bucket=bucket)
d = dwnld.download(chunks=5, resume=True)
d.addCallback(callb)
d.addErrback(err)