From 9b9b7d4fd75f88492ab407cc2ccbdc7df3054323 Mon Sep 17 00:00:00 2001 From: mkaay Date: Sat, 25 Dec 2010 00:24:24 +0100 Subject: fixed weird issues, comments --- module/network/HTTPChunk.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'module/network/HTTPChunk.py') 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) -- cgit v1.2.3