From 4a76da1833922c74e147be5def9bfe04fd0c16a2 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 30 Dec 2010 08:32:28 +0000 Subject: coolio: rename deferred_response => response_pipe For consistency with the EventMachine code --- lib/rainbows/coolio/response_pipe.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lib/rainbows/coolio/response_pipe.rb (limited to 'lib/rainbows/coolio/response_pipe.rb') diff --git a/lib/rainbows/coolio/response_pipe.rb b/lib/rainbows/coolio/response_pipe.rb new file mode 100644 index 0000000..42483c2 --- /dev/null +++ b/lib/rainbows/coolio/response_pipe.rb @@ -0,0 +1,20 @@ +# -*- encoding: binary -*- +# :enddoc: +# +# this is class is specific to Coolio for writing large static files +# or proxying IO-derived objects +class Rainbows::Coolio::ResponsePipe < Coolio::IO + def initialize(io, client, body) + super(io) + @client, @body = client, body + end + + def on_read(data) + @client.write(data) + end + + def on_close + @body.respond_to?(:close) and @body.close + @client.next! + end +end -- cgit v1.2.3-24-ge0c7