about summary refs log tree commit homepage
path: root/lib/rainbows/base.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rainbows/base.rb')
-rw-r--r--lib/rainbows/base.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/rainbows/base.rb b/lib/rainbows/base.rb
index 4597239..62a7701 100644
--- a/lib/rainbows/base.rb
+++ b/lib/rainbows/base.rb
@@ -32,7 +32,7 @@ module Rainbows
     # once a client is accepted, it is processed in its entirety here
     # in 3 easy steps: read request, call app, write app response
     def process_client(client)
-      buf = client.readpartial(CHUNK_SIZE)
+      buf = client.readpartial(CHUNK_SIZE) # accept filters protect us here
       hp = HttpParser.new
       env = {}
       alive = true
@@ -40,6 +40,7 @@ module Rainbows
 
       begin # loop
         while ! hp.headers(env, buf)
+          IO.select([client], nil, nil, 5) or return client.close
           buf << client.readpartial(CHUNK_SIZE)
         end