j2labs / brubeck

Asynchronous web and messaging
http://brubeck.io
511 stars 66 forks source link

Allow Mongrel2 Async File Upload Support #107

Closed jmaygarden closed 11 years ago

jmaygarden commented 11 years ago

This is a simple one line change that allows support for 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.

sethmurphy commented 11 years ago

I like this. It has always bothered me slightly that a message had to be sent back to Mongrel2 from the initial handler at all. What about a case where you want to pass the work off to another instance of anything anywhere and have that use 0MQ to return the response back to Mongrel2. This should be possible too.

With this patch it would be possible to ignore responding from a handler for whichever reason you like.

lkraider commented 11 years ago

I agree, makes sense. I'll merge the request in a few days if no one disagrees.

gone commented 11 years ago

YEAH MERGE POWERS On Feb 26, 2013 5:18 PM, "Paul Eipper" notifications@github.com wrote:

I agree, makes sense. I'll merge the request in a few days if no one disagrees.

— Reply to this email directly or view it on GitHubhttps://github.com/j2labs/brubeck/pull/107#issuecomment-14143480 .

kracekumar commented 11 years ago

Looks good.