MCPcopy
hub / github.com/aio-libs/aiohttp / _write_chunked_payload

Method _write_chunked_payload

aiohttp/protocol.py:739–752  ·  view source on GitHub ↗

Write data in chunked transfer encoding.

(self)

Source from the content-addressed store, hash-verified

737 return self.transport.drain()
738
739 def _write_chunked_payload(self):
740 """Write data in chunked transfer encoding."""
741 while True:
742 try:
743 chunk = yield
744 except aiohttp.EofStream:
745 self.transport.write(b'0\r\n\r\n')
746 self.output_length += 5
747 break
748
749 chunk = bytes(chunk)
750 chunk_len = '{:x}\r\n'.format(len(chunk)).encode('ascii')
751 self.transport.write(chunk_len + chunk + b'\r\n')
752 self.output_length += len(chunk_len) + len(chunk) + 2
753
754 def _write_length_payload(self, length):
755 """Write specified number of bytes to a stream."""

Callers 1

send_headersMethod · 0.95

Calls 2

encodeMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected