- buf = buf.lstrip() # Remove any keep-alive delimiters
- try:
- res, ptr = raw_decode(buf)
- buf = buf[ptr:]
- except ValueError:
- if not self.block and not self.timeout:
- yield None
- else:
- yield wrap_response(res, self.handle.headers)
- timer.reset()
+ # Decode all the things:
+ data = sock_reader.read()
+ dechunked_data, end_of_stream, decode_error = chunk_decoder.decode(data)
+ unicode_data = utf8_decoder.decode(dechunked_data)
+ json_data = json_decoder.decode(unicode_data)
+
+ # Yield data-like things:
+ for json_obj in json_data:
+ yield wrap_response(json_obj, headers)
+
+ # Reset timers:
+ if dechunked_data: