summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-01-09 18:43:50 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-01-09 18:43:50 +0100
commit2d894dc7b43313d021d61ba201d0efa10994c696 (patch)
tree44dd070745e86b8d7fe1f392e7eb7416baf7ec77 /module
parentdisabled chunk download for files.mail.ru (diff)
downloadpyload-2d894dc7b43313d021d61ba201d0efa10994c696.tar.xz
enabled chunk download for files.mail.ru
Diffstat (limited to 'module')
-rw-r--r--module/network/HTTPChunk.py14
-rw-r--r--module/plugins/hoster/FilesMailRu.py2
2 files changed, 13 insertions, 3 deletions
diff --git a/module/network/HTTPChunk.py b/module/network/HTTPChunk.py
index 573ed1766..89770769f 100644
--- a/module/network/HTTPChunk.py
+++ b/module/network/HTTPChunk.py
@@ -142,6 +142,8 @@ class HTTPChunk(HTTPRequest):
self.c.setopt(pycurl.WRITEFUNCTION, self.writeBody)
self.c.setopt(pycurl.HEADERFUNCTION, self.writeHeader)
+ # request one byte more, since some servers in russia seems to have a defect arihmetic unit
+
if self.resume:
self.fp = open(self.p.info.getChunkName(self.id), "ab")
self.arrived = self.fp.tell()
@@ -150,7 +152,11 @@ class HTTPChunk(HTTPRequest):
#do nothing if chunk already finished
if not self.arrived + self.range[0] - self.range[1]: return None
- range = "%i-%i" % (self.arrived + self.range[0], self.range[1])
+ if self.id == len(self.p.info.chunks) - 1: #as last chunk dont set end range, so we get everything
+ range = "%i-" % self.range[0]
+ else:
+ range = "%i-%i" % (self.arrived + self.range[0], min(self.range[1] + 1, self.p.size - 1))
+
print "Chunked resume with range %s" % range
self.c.setopt(pycurl.RANGE, range)
else:
@@ -159,7 +165,11 @@ class HTTPChunk(HTTPRequest):
else:
if self.range:
- range = "%i-%i" % self.range
+ if self.id == len(self.p.info.chunks) - 1: # see above
+ range = "%i-" % self.range[0]
+ else:
+ range = "%i-%i" % (self.range[0], min(self.range[1] + 1, self.p.size - 1))
+
print "Chunked with range %s" % range
self.c.setopt(pycurl.RANGE, range)
diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py
index ff6cb76a9..3fa40cbd0 100644
--- a/module/plugins/hoster/FilesMailRu.py
+++ b/module/plugins/hoster/FilesMailRu.py
@@ -41,7 +41,7 @@ class FilesMailRu(Hoster):
def setup(self):
self.multiDL = True
self.resumeDownload = True
- self.chunkLimit = 1
+ self.chunkLimit = -1
def process(self, pyfile):
self.html = self.load(pyfile.url)