Commit b6989acf authored by Julien Muchembled's avatar Julien Muchembled

fixup! download: verify checksum of downloaded data

parent 316d365a
...@@ -90,9 +90,9 @@ class CheckResponse(object): ...@@ -90,9 +90,9 @@ class CheckResponse(object):
def read(self, amt=None): def read(self, amt=None):
r = self._response.read(amt) r = self._response.read(amt)
if r: self._sha512sum.update(r)
self._sha512sum.update(r) if (not r if amt else amt is None) and \
elif amt != 0 and self._expected != self._sha512sum.hexdigest(): self._expected != self._sha512sum.hexdigest():
raise NetworkcacheException( raise NetworkcacheException(
'Failed to download data to SHACACHE Server: invalid checksum.') 'Failed to download data to SHACACHE Server: invalid checksum.')
return r return r
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment