From 7bfd7995fd403f80940e3f6ac36f9ae58b7040cb Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 26 Dec 2010 03:30:36 +0000 Subject: avoid HttpParser#keepalive? and HttpParser#reset The HttpParser#next? method will come with keepalive protection for Rainbows!, which can prevent clients from monopolizing a server with excessive pipelining/keepalive requests. --- lib/rainbows/event_machine.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/rainbows/event_machine.rb') diff --git a/lib/rainbows/event_machine.rb b/lib/rainbows/event_machine.rb index 99fa32e..8029b1a 100644 --- a/lib/rainbows/event_machine.rb +++ b/lib/rainbows/event_machine.rb @@ -91,10 +91,9 @@ module Rainbows::EventMachine # long-running async response (response.nil? || -1 == response[0]) and return @state = :close - alive = @hp.keepalive? && G.alive && G.kato > 0 + alive = @hp.next? && G.alive && G.kato > 0 em_write_response(response, alive) if alive - @hp.reset @state = :headers if @buf.empty? set_comm_inactivity_timeout(G.kato) -- cgit v1.2.3-24-ge0c7