about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-01-20 02:28:12 -0800
committerEric Wong <normalperson@yhbt.net>2011-01-20 02:28:12 -0800
commit72cbecfe01b8c4b2c7bb7e362401805374036dc2 (patch)
tree54997f0023c98a8a4fc0296079cf990ca8d5ec0d
parented33b9c0d060806b41e952a50e0ab65a0f5fe21a (diff)
downloadrainbows-72cbecfe01b8c4b2c7bb7e362401805374036dc2.tar.gz
It turns out to be less-used than previous anticipated,
so there's no point in having yet another module.
-rw-r--r--lib/rainbows.rb1
-rw-r--r--lib/rainbows/base.rb1
-rw-r--r--lib/rainbows/process_client.rb12
-rw-r--r--lib/rainbows/rack_input.rb17
4 files changed, 11 insertions, 20 deletions
diff --git a/lib/rainbows.rb b/lib/rainbows.rb
index e559919..3a015f9 100644
--- a/lib/rainbows.rb
+++ b/lib/rainbows.rb
@@ -25,7 +25,6 @@ module Rainbows
   require 'rainbows/const'
   require 'rainbows/http_parser'
   require 'rainbows/http_server'
-  autoload :RackInput, 'rainbows/rack_input'
   autoload :Response, 'rainbows/response'
   autoload :ProcessClient, 'rainbows/process_client'
   autoload :Client, 'rainbows/client'
diff --git a/lib/rainbows/base.rb b/lib/rainbows/base.rb
index b94ddc9..e0c99e9 100644
--- a/lib/rainbows/base.rb
+++ b/lib/rainbows/base.rb
@@ -13,7 +13,6 @@ module Rainbows::Base
     super(worker)
     Rainbows::Response.setup(self.class)
     Rainbows::MaxBody.setup
-    Rainbows::RackInput.setup
     Rainbows.tick_io = worker.tmp
 
     listeners = Rainbows::HttpServer::LISTENERS
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
diff --git a/lib/rainbows/rack_input.rb b/lib/rainbows/rack_input.rb
deleted file mode 100644
index bc68ed1..0000000
--- a/lib/rainbows/rack_input.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# -*- encoding: binary -*-
-# :enddoc:
-# only used by synchronous interfaces
-module Rainbows::RackInput
-  NULL_IO = Unicorn::HttpRequest::NULL_IO
-  RACK_INPUT = Unicorn::HttpRequest::RACK_INPUT
-  CLIENT_IO = Rainbows::Const::CLIENT_IO
-
-  def self.setup
-    const_set(:IC, Unicorn::HttpRequest.input_class)
-  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