From 7b01d94dd9287ac402d91451f1e93c9faaf913c4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 18 Oct 2009 15:59:29 -0700 Subject: rev: async response bodies with DevFdResponse middleware This new middleware should be a no-op for non-Rev concurrency models (or by explicitly setting env['rainbows.autochunk'] to false). Setting env['rainbows.autochunk'] to true (the default when Rev is used) allows (e)poll-able IO objects (sockets, pipes) to be sent asynchronously after app.call(env) returns. This also has a fortunate side effect of introducing a code path which allows large, static files to be sent without slurping them into a Rev IO::Buffer, too. This new change works even without the DevFdResponse middleware, so you won't have to reconfigure your app. This lets us epoll on response bodies that come in from a pipe or even a socket and send them either straight through or with chunked encoding. --- lib/rainbows/http_server.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/rainbows/http_server.rb') diff --git a/lib/rainbows/http_server.rb b/lib/rainbows/http_server.rb index 6d61228..5521513 100644 --- a/lib/rainbows/http_server.rb +++ b/lib/rainbows/http_server.rb @@ -33,6 +33,7 @@ module Rainbows extend(mod) Const::RACK_DEFAULTS['rainbows.model'] = @use = model Const::RACK_DEFAULTS['rack.multithread'] = !!(/Thread/ =~ model.to_s) + Const::RACK_DEFAULTS['rainbows.autochunk'] = (model.to_s == "Rev") end def worker_connections(*args) -- cgit v1.2.3-24-ge0c7