facebook/tornado — pull request #1021 by bdarnell (2014-03-24 02:59:37+00:00)
Title: Major HTTP refactoring for streaming uploads

Most HTTP processing is now shared between HTTPServer and SimpleAsyncHTTPClient, and coroutines are used internally. Redundant parts of the tornado.wsgi module have also been merged.

At the tornado.web level, a RequestHandler can now use the `@stream_request_body` decorator and define a `data_received` method to receive data as it comes in. At lower levels, the HTTPMessageDelegate interface is used.

In addition to the primary goal of streaming request bodies, this enables a number of other features:
* Chunked encoding (and optionally gzip) for request bodies in HTTPServer
* Gzip responses on WSGI
* Optimizations of gen.Runner and the coroutine machinery
* Laying the groundwork for HTTP/2 support

Still TODO:
* [ ] Allow `data_received` callbacks to return a `Future` to apply backpressure
* [ ] Add configurable limits for header, chunk, and total message sizes