about summary refs log tree commit homepage
path: root/lib/rainbows/process_client.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rainbows/process_client.rb')
-rw-r--r--lib/rainbows/process_client.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/rainbows/process_client.rb b/lib/rainbows/process_client.rb
index d840778..2ddc368 100644
--- a/lib/rainbows/process_client.rb
+++ b/lib/rainbows/process_client.rb
@@ -1,9 +1,14 @@
 # -*- encoding: binary -*-
+# :enddoc:
 module Rainbows::ProcessClient
   include Rainbows::Response
-  include Rainbows::RackInput
   include Rainbows::Const
 
+  NULL_IO = Unicorn::HttpRequest::NULL_IO
+  RACK_INPUT = Unicorn::HttpRequest::RACK_INPUT
+  CLIENT_IO = "hack.io".freeze
+  IC = Unicorn::HttpRequest.input_class
+
   def process_loop
     @hp = hp = Rainbows::HttpParser.new
     kgio_read!(16384, buf = hp.buf) or return
@@ -38,4 +43,9 @@ module Rainbows::ProcessClient
   def handle_error(e)
     Rainbows::Error.write(self, e)
   end
+
+  def set_input(env, hp)
+    env[RACK_INPUT] = 0 == hp.content_length ? NULL_IO : IC.new(self, hp)
+    env[CLIENT_IO] = self
+  end
 end