Fix gzip wrap to keep reading from the buffer once the inner loop has completed

This commit is contained in:
Joseph Schorr 2014-10-15 17:24:17 -04:00
parent e4d9bacccb
commit ee99e68a67

View file

@ -11,12 +11,9 @@ class GzipWrap(object):
self.is_done = False
def read(self, size=-1):
if self.is_done:
return ''
# If the buffer already has enough bytes, then simply pop them off of
# the beginning and return them.
if len(self.buffer) >= size:
if len(self.buffer) >= size or self.is_done:
ret = self.buffer[0:size]
self.buffer = self.buffer[size:]
return ret