j2labs/brubeck — pull request #107 by jmaygarden (2013-02-22 01:27:59+00:00)
Title: Allow Mongrel2 Async File Upload Support

This is a simple one line change that allows support on Mongrel2 asynchronous uploads.

By making responses to each ZMQ message optional, a Brubeck handler can make use of Mongrel2 asynchronous file uploads. See section "5.5 Async File Upload Demo" of the Mongrel2 manual if you are not familiar with this feature ( http://mongrel2.org/manual/book-finalch6.html ).

This patch let me catch "x-mongrel2-upload-start" and "x-mongrel2-upload-done" headers in separate messages, read uploaded files and then respond. If a response is sent before "x-mongrel2-upload-done" is received, then the transfer is cancelled before it can complete.