about summary refs log tree commit homepage
path: root/lib/rainbows/revactor.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-08-02 01:24:25 +0000
committerEric Wong <normalperson@yhbt.net>2010-08-02 01:29:31 +0000
commit3a96720e4e0f1d14599b9fae10e210110976e0c5 (patch)
tree75ef1525ad9e615eb634b84aa811e64ed332cd99 /lib/rainbows/revactor.rb
parent44f66366245c9fbe065ba8cd95ca704c05c53639 (diff)
downloadrainbows-3a96720e4e0f1d14599b9fae10e210110976e0c5.tar.gz
Due to the synchronous nature of Revactor, we can
be certain sendfile won't overstep the userspace
output buffering done by Rev.
Diffstat (limited to 'lib/rainbows/revactor.rb')
-rw-r--r--lib/rainbows/revactor.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/rainbows/revactor.rb b/lib/rainbows/revactor.rb
index 8ec791d..10b7d3c 100644
--- a/lib/rainbows/revactor.rb
+++ b/lib/rainbows/revactor.rb
@@ -61,15 +61,12 @@ module Rainbows::Revactor
 
       if hp.headers?
         headers = HH.new(headers)
-        headers[CONNECTION] = if hp.keepalive? && G.alive
-          KEEP_ALIVE
-        else
-          env = false
-          CLOSE
-        end
+        range = make_range!(env, status, headers) and status = range.shift
+        env = false unless hp.keepalive? && G.alive
+        headers[CONNECTION] = env ? KEEP_ALIVE : CLOSE
         client.write(response_header(status, headers))
       end
-      write_body(client, body)
+      write_body(client, body, range)
     end while env && env.clear && hp.reset.nil?
   rescue ::Revactor::TCP::ReadError
   rescue => e
@@ -83,7 +80,8 @@ module Rainbows::Revactor
   # given a INT, QUIT, or TERM signal)
   def worker_loop(worker) #:nodoc:
     init_worker_process(worker)
-    self.class.__send__(:alias_method, :write_body, :write_body_each)
+    require 'rainbows/revactor/body'
+    self.class.__send__(:include, Rainbows::Revactor::Body)
     RD_ARGS[:timeout] = G.kato if G.kato > 0
     nr = 0
     limit = worker_connections