From 71ecfee987f13ba447abe97cac14274f38ff70f4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 27 Jul 2010 06:36:07 +0000 Subject: event_machine: fix pipelining of static files EM::FileStreamer writes may be intermingled with the headers in the subsequent response if we enable processing of the second pipelined response right away, so wait until the first response is complete before hitting the second one. This also avoids potential deep stack recursion in the unlikely case where too many requests are pipelined. --- lib/rainbows/event_machine/response_pipe.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/rainbows/event_machine') diff --git a/lib/rainbows/event_machine/response_pipe.rb b/lib/rainbows/event_machine/response_pipe.rb index 7d4988a..2417dbe 100644 --- a/lib/rainbows/event_machine/response_pipe.rb +++ b/lib/rainbows/event_machine/response_pipe.rb @@ -22,7 +22,8 @@ module Rainbows::EventMachine::ResponsePipe end def unbind - @client.quit unless @alive + @client.body = nil + @alive ? @client.on_read('') : @client.quit @body.close if @body.respond_to?(:close) @io.close unless @io.closed? end -- cgit v1.2.3-24-ge0c7