Iter body lines to avoid binary false positives.

#84
This commit is contained in:
Jakub Roztocil 2012-08-13 23:32:33 +02:00
parent 9098e5b6e8
commit b92a3a6d95

View File

@ -262,10 +262,10 @@ class BufferedPrettyStream(PrettyStream):
# Read the whole body before prettifying it,
# but bail out immediately if the body is binary.
body = bytearray()
for chunk in self.msg.iter_body(self.CHUNK_SIZE):
for chunk, lf in self.msg.iter_lines(self.CHUNK_SIZE):
if b'\0' in chunk:
raise BinarySuppressedError()
body.extend(chunk)
body.extend(chunk + lf)
yield self._process_body(body)