about summary refs log tree commit homepage
path: root/lib/rainbows/event_machine
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-07-27 06:36:07 +0000
committerEric Wong <normalperson@yhbt.net>2010-07-27 07:00:55 +0000
commit71ecfee987f13ba447abe97cac14274f38ff70f4 (patch)
tree9c255960dca3fa1440ff024f85fec5ce93142687 /lib/rainbows/event_machine
parent052e2b3608071d9cd9d6b1d12f8cb69ac29124af (diff)
downloadrainbows-71ecfee987f13ba447abe97cac14274f38ff70f4.tar.gz
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.
Diffstat (limited to 'lib/rainbows/event_machine')
-rw-r--r--lib/rainbows/event_machine/response_pipe.rb3
1 files changed, 2 insertions, 1 deletions
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