From 39b178cdebe275cbc8ce19cf269bea7cd15ff4ca Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 4 Jul 2010 22:16:52 +0000 Subject: refactor response body handling for sendfile(2) This hopefully allows the "sendfile" gem to be required anywhere in the Rainbows!/Unicorn config file, and not have to be required via RUBYOPT or the '-r' command-line switch. We also modularize HttpResponse and avoids singleton methods in the response path. This (hopefully) makes it easier for individual concurrency models to share code and override individual methods. --- lib/rainbows/fiber/rev.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/rainbows/fiber/rev.rb') diff --git a/lib/rainbows/fiber/rev.rb b/lib/rainbows/fiber/rev.rb index b8ec56b..2e8f076 100644 --- a/lib/rainbows/fiber/rev.rb +++ b/lib/rainbows/fiber/rev.rb @@ -52,6 +52,7 @@ module Rainbows::Fiber include Unicorn include Rainbows include Rainbows::Const + include Rainbows::HttpResponse FIO = Rainbows::Fiber::IO def to_io @@ -99,7 +100,7 @@ module Rainbows::Fiber alive = hp.keepalive? && G.alive out = [ alive ? CONN_ALIVE : CONN_CLOSE ] if hp.headers? - HttpResponse.write(client, response, out) + write_response(client, response, out) end while alive and hp.reset.nil? and env.clear rescue => e Error.write(io, e) -- cgit v1.2.3-24-ge0c7