Took some time to debug, but passing an asyncio.StreamWriter instance to a coroutine executed as a task (either as argument or in a closure) will close the writer. 🤷

Anyway, streaming HTTP message handling matures. SteamReader and StreamWriter of a request connection now get wrapped in custom Decoder/Encoder instances to implement content and transfer encodings (deflate, gzip, chunked, and plain old content-length).

#python3 #asyncio #streams #rfc9110 #rfc9112 #serversentevents

chunked transfer decoding ✅

I had to split HTTP message handling from my HTTPd.py server into a separate module in order to replace urllib.request with an async version.

While testing I stumbled over forums.gentoo.org chunked transfer encoding and devided to integrate transfer decoding in the parsing method.

#python3 #asyncio #HTTP #rfc9110 #rfc9112