Write specified number of bytes to a stream.
(self, length)
| 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: |