def _read_stream_body(self, content_length, delegate):
while 0 < content_length:
try:
body = yield self.stream.read_bytes(
min(self.params.chunk_size, content_length), partial=True)
except StreamClosedError:
# with partial stream will update close status after receiving
# the last chunk, so we catch StreamClosedError instead
raise gen.Return(False)
content_length -= len(body)
if not self._write_finished or self.is_client:
with _ExceptionLoggingContext(app_log):
ret = delegate.data_received(body)
if ret is not None:
yield ret
raise gen.Return(True)
评论列表
文章目录