diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-07-19 10:10:06 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-07-19 17:04:37 -0700 |
commit | 60039518e03b0f1a0f530eefe008ebf72c55afe4 (patch) | |
tree | c31a8ff013634812ae71f7c935d309c652d5052a /lib/rainbows/event_machine.rb | |
parent | 0cd65fa1e01be369b270c72053cf21a3d6bcb45f (diff) | |
download | rainbows-60039518e03b0f1a0f530eefe008ebf72c55afe4.tar.gz |
Middlewares like Clogger may wrap Rack::File responses with another body that responds to to_path and still rely on #close to trigger an action (writing out the log file).
Diffstat (limited to 'lib/rainbows/event_machine.rb')
-rw-r--r-- | lib/rainbows/event_machine.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/rainbows/event_machine.rb b/lib/rainbows/event_machine.rb index 4faa7a6..696f5a0 100644 --- a/lib/rainbows/event_machine.rb +++ b/lib/rainbows/event_machine.rb @@ -121,7 +121,10 @@ module Rainbows if st.file? write(response_header(status, headers)) if headers @body = stream = stream_file_data(body.to_path) - stream.callback { quit } unless alive + stream.callback do + body.close if body.respond_to?(:close) + quit unless alive + end return elsif st.socket? || st.pipe? chunk = stream_response_headers(status, headers) if headers |