2.3.0 Release Notes

Channels 2.3.0 updates the AsgiHandler HTTP request body handling to use a spooled temporary file, rather than reading the whole request body into memory.

This significantly reduces the maximum memory requirements when serving Django views, and protects from DoS attacks, whilst still allowing large file uploads — a combination that had previously been difficult.

Many thanks to Ivan Ergunov for his work on the improvements! 🎩

Backwards Incompatible Changes

As a result of the reworked body handling, AsgiRequest.__init__() is adjusted to expect a file-like stream, rather than the whole body as bytes.

Test cases instantiating requests directly will likely need to be updated to wrap the provided body in, e.g., io.BytesIO.

Next Up…

We’re looking to address a few issues around AsyncHttpConsumer. Any human-power available to help on that, truly appreciated. 🙂