about summary refs log tree commit homepage
path: root/lib/rainbows/process_client.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-04-29 05:45:44 +0000
committerEric Wong <normalperson@yhbt.net>2011-04-29 05:45:44 +0000
commitaff36865d5e738babdbf36f34fd0693b67bb3d90 (patch)
tree24bcb22e23dc7e7c587f34bba33dfcbee8c020fb /lib/rainbows/process_client.rb
parent40cf3eb79054caa4b7d81120a736491aca8259eb (diff)
downloadrainbows-aff36865d5e738babdbf36f34fd0693b67bb3d90.tar.gz
Whee!  This is going to be awesome.
Diffstat (limited to 'lib/rainbows/process_client.rb')
-rw-r--r--lib/rainbows/process_client.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/rainbows/process_client.rb b/lib/rainbows/process_client.rb
index bf6d20b..24132f5 100644
--- a/lib/rainbows/process_client.rb
+++ b/lib/rainbows/process_client.rb
@@ -46,4 +46,25 @@ module Rainbows::ProcessClient
   def set_input(env, hp)
     env[RACK_INPUT] = 0 == hp.content_length ? NULL_IO : IC.new(self, hp)
   end
+
+  def process_pipeline(env, hp)
+    begin
+      set_input(env, hp)
+      env[REMOTE_ADDR] = kgio_addr
+      status, headers, body = APP.call(env.merge!(RACK_DEFAULTS))
+      if 100 == status.to_i
+        write(EXPECT_100_RESPONSE)
+        env.delete(HTTP_EXPECT)
+        status, headers, body = APP.call(env)
+      end
+      write_response(status, headers, body, alive = hp.next?)
+    end while alive && env = pipeline_ready(hp)
+    alive or close
+    rescue => e
+      handle_error(e)
+  end
+
+  # override this in subclass/module
+  def pipeline_ready
+  end
 end