How to tell Django not to buffer the HTTP POST data?

Viewed 1224

The client is posting mjpeg stream as HTTP POST:

POST /feed/testfeed HTTP/1.0
Content-type: multipart/x-mixed-replace; boundary=--myboundary

--myboundary
Content-length: 14179
Content-type: image/jpeg

....JFIF....
....

I see no incoming data in Django at all. request.read(6) returns empty string. I add fake "content-Length" header:

POST /feed/testfeed HTTP/1.0
Content-Length: -1
Content-type: multipart/x-mixed-replace; boundary=--myboundary

...

Now it reads the whole data with maximum speed. request.read(6) returns (with the whole data, not just expected 6 bytes) only after I interrupt the connection.

The same behaviour is when I use "PUT" request instead of "POST" one.

How to turn off buffering of the POST request?

1 Answers
Related