summaryrefslogtreecommitdiff
path: root/python/subunit/chunked.py
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2009-10-13 15:52:06 +1100
committerRobert Collins <robertc@robertcollins.net>2009-10-13 15:52:06 +1100
commit236a0392e2d4ae550addac6bea02c7edb093c75f (patch)
treec96dcd1a1ef9be35f2d5d65ce92ff63261167a1c /python/subunit/chunked.py
parent129250bcfcdd915a1c8e71348efacdfda73d0594 (diff)
downloadsubunit-git-236a0392e2d4ae550addac6bea02c7edb093c75f.tar.gz
Small buffering bugs in chunked decoder.
Diffstat (limited to 'python/subunit/chunked.py')
-rw-r--r--python/subunit/chunked.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/python/subunit/chunked.py b/python/subunit/chunked.py
index 89fb97b..82e4b0d 100644
--- a/python/subunit/chunked.py
+++ b/python/subunit/chunked.py
@@ -55,11 +55,13 @@ class Decoder(object):
def _read_body(self):
"""Pass body bytes to the output."""
while self.body_length and self.buffered_bytes:
- if self.body_length >= self.buffered_bytes[0]:
+ if self.body_length >= len(self.buffered_bytes[0]):
self.output.write(self.buffered_bytes[0])
self.body_length -= len(self.buffered_bytes[0])
- self.state = self._read_length
- # No more data.
+ del self.buffered_bytes[0]
+ # No more data available.
+ if not self.body_length:
+ self.state = self._read_length
else:
self.output.write(self.buffered_bytes[0][:self.body_length])
self.buffered_bytes[0] = \