From ed14b9bdbb35fa18dc283ba2d048a33d10759b2d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 19 Jul 2010 10:10:04 +0000 Subject: rev: split out deferred chunk logic from unchunked Similar to what we do in EM, this avoid unnecessary conditional logic inside more frequently used code paths. --- lib/rainbows/rev/deferred_response.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib/rainbows/rev/deferred_response.rb') diff --git a/lib/rainbows/rev/deferred_response.rb b/lib/rainbows/rev/deferred_response.rb index f0172d6..13396d8 100644 --- a/lib/rainbows/rev/deferred_response.rb +++ b/lib/rainbows/rev/deferred_response.rb @@ -4,19 +4,16 @@ # this is class is specific to Rev for writing large static files # or proxying IO-derived objects class Rainbows::Rev::DeferredResponse < ::Rev::IO - def initialize(io, client, do_chunk, body) + def initialize(io, client, body) super(io) - @client, @do_chunk, @body = client, do_chunk, body + @client, @body = client, body end def on_read(data) - @do_chunk and @client.write("#{data.size.to_s(16)}\r\n") @client.write(data) - @do_chunk and @client.write("\r\n") end def on_close - @do_chunk and @client.write("0\r\n\r\n") @client.next @body.respond_to?(:close) and @body.close end -- cgit v1.2.3-24-ge0c7