Skip to content

Commit

Permalink
preen
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Nov 12, 2024
1 parent ac68d1f commit 7d7a2c1
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions aiohttp/http_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,22 +174,16 @@ async def write_eof(self, chunk: bytes = b"") -> None:
chunks.append(flush_chunk)

if self.chunked:
self._writelines(
(
f"{chunks_len:x}\r\n".encode("ascii"),
*chunks,
b"\r\n0\r\n\r\n",
)
)
chunk_pre = f"{chunks_len:x}\r\n".encode("ascii")
self._writelines((chunk_pre, *chunks, b"\r\n0\r\n\r\n"))
elif chunks_len and len(chunks) == 1:
self._write(chunks[0])
elif chunks_len:
self._writelines(chunks)
elif self.chunked:
if chunk:
self._writelines(
(f"{len(chunk):x}\r\n".encode("ascii"), chunk, b"\r\n0\r\n\r\n")
)
chunk_pre = f"{len(chunk):x}\r\n".encode("ascii")
self._writelines((chunk_pre, chunk, b"\r\n0\r\n\r\n"))
else:
self._write(b"0\r\n\r\n")
elif chunk:
Expand Down

0 comments on commit 7d7a2c1

Please sign in to comment.