summaryrefslogtreecommitdiffstats
path: root/module/network/HTTPChunk.py
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2010-12-25 00:24:24 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2010-12-25 00:24:24 +0100
commit9b9b7d4fd75f88492ab407cc2ccbdc7df3054323 (patch)
tree538472b1970d75ddd97a5b9a4b76faa2ba91bc58 /module/network/HTTPChunk.py
parentfixed reusing bad connection (diff)
downloadpyload-9b9b7d4fd75f88492ab407cc2ccbdc7df3054323.tar.xz
fixed weird issues, comments
Diffstat (limited to 'module/network/HTTPChunk.py')
-rw-r--r--module/network/HTTPChunk.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/module/network/HTTPChunk.py b/module/network/HTTPChunk.py
index 48ebc13f3..02134ca63 100644
--- a/module/network/HTTPChunk.py
+++ b/module/network/HTTPChunk.py
@@ -85,7 +85,7 @@ class HTTPChunk(HTTPBase):
try:
data = resp.read(count)
except:
- self.deferred.error("timeout")
+ self.deferred.error(Fail, "timeout")
break
if self.speedCalcTime < inttime():
@@ -104,7 +104,7 @@ class HTTPChunk(HTTPBase):
if self.noRangeHeader and self.arrived == self.range[1]:
running = False
- if data:
+ if size:
self.fh.write(data)
else:
break
@@ -117,9 +117,10 @@ class HTTPChunk(HTTPBase):
if self.abort:
self.deferred.error(Abort)
elif self.size == self.arrived:
- self.deferred.callback(resp)
+ self.deferred.callback()
else:
- self.deferred.error(Fail)
+ print self.arrived, self.size
+ self.deferred.error(Fail, "wrong content-length")
def getEncoding(self):
try:
@@ -140,7 +141,7 @@ class HTTPChunk(HTTPBase):
self.deferred.error(e)
return self.deferred
- if (self.range and resp.getcode() == 206) or (not self.range and resp.getcode() == 200):
+ if resp.getcode() in (200, 206):
self._download(resp)
else:
self.deferred.error(resp.getcode(), resp)