From 593fd91098cbfac13063779226ea65cf5674e3cd Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 19 Jul 2010 10:10:00 +0000 Subject: event_machine: don't set @body unless it's EM::Deferrable We also properly fail on EM::FileStreamer responses, too --- lib/rainbows/event_machine.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/rainbows/event_machine.rb') diff --git a/lib/rainbows/event_machine.rb b/lib/rainbows/event_machine.rb index 3da6565..0876ac9 100644 --- a/lib/rainbows/event_machine.rb +++ b/lib/rainbows/event_machine.rb @@ -106,9 +106,9 @@ module Rainbows else headers = nil end - @body = body if body.respond_to?(:errback) && body.respond_to?(:callback) + @body = body body.callback { quit } body.errback { quit } # async response, this could be a trickle as is in comet-style apps @@ -120,7 +120,7 @@ module Rainbows if st.file? write(response_header(status, headers)) if headers - stream = stream_file_data(body.to_path) + @body = stream = stream_file_data(body.to_path) stream.callback { quit } unless alive return elsif st.socket? || st.pipe? -- cgit v1.2.3-24-ge0c7