Way ahead of you Justin: https://github.com/zedshaw/mongrel2/commit/72602f91cfb85d3975a4366ab2dbfeb1a756b7c8
Quick summary; set the first connection id to "X" to indicate an extended request. The payload must then be a tnetstring list. The first item in the list is used as an identifier to dispatch to a plugin. The rest of the list will be specific to the type it is. I implemented an example "X-Sendfile" like interface as an example of how to use it. Links to them in github below. -Jason Python handler: https://github.com/zedshaw/mongrel2/blob/develop/examples/http_0mq/sendfile.py Plugin to go with it: https://github.com/zedshaw/mongrel2/blob/develop/tools/filters/sendfile.c On 08:46 Fri 26 Apr , Justin Karneges wrote: > Hey people, > > I want to be able to do more with responses but I'm not sure how to > extend the format without breaking backwards compatibility. > > Maybe a good way to handle this is to have mongrel2 inform its ability > to support additional formatting in the messages that it sends to > workers. Then workers can respond with a non-backwards-compatible > format, but this is okay, since they'd have confirmed that the version > of mongrel2 talking to them is capable of understanding it. > > Maybe we could use another all-uppercase header to trigger this, like > "EXTENDED_RESPONSE" set to "1". Responses could be of the form: > "{instance} {tnet request id(s) string} {tnet extension dict} {data}". > Then we can forever play with that extension dict and hopefully not have > to hack anything on top of the system again. > > One type of extension I want to add is the ability to keep-alive a > connection (reset mongrel2's internal timer for the connection) without > having to actually send data down to the client. Currently, sending 0 > data means disconnect, so we need another way. We could use the > extension dict to set something like keep-alive=true. > > Really would like feedback on this before I start hacking. Thanks. :) > > Justin >
