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

Method _write_length_payload

aiohttp/protocol.py:754–771  ·  view source on GitHub ↗

Write specified number of bytes to a stream.

(self, length)

Source from the content-addressed store, hash-verified

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."""
756 while True:
757 try:
758 chunk = yield
759 except aiohttp.EofStream:
760 break
761
762 if length:
763 l = len(chunk)
764 if length >= l:
765 self.transport.write(chunk)
766 self.output_length += l
767 length = length-l
768 else:
769 self.transport.write(chunk[:length])
770 self.output_length += length
771 length = 0
772
773 def _write_eof_payload(self):
774 while True:

Callers 1

send_headersMethod · 0.95

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected