several response body#close fixes
[rainbows.git] / lib / rainbows / rev / deferred_response.rb
blob4a92ee471b575ca565529687a2dbad0f3ccdcc72
1 # -*- encoding: binary -*-
2 # :enddoc:
4 # this is class is specific to Rev for writing large static files
5 # or proxying IO-derived objects
6 class Rainbows::Rev::DeferredResponse < Rev::IO
7   def initialize(io, client, body)
8     super(io)
9     @client, @body = client, body
10   end
12   def on_read(data)
13     @client.write(data)
14   end
16   def on_close
17     @body.respond_to?(:close) and @body.close
18     @client.next!
19   end
20 end