about summary refs log tree commit homepage
path: root/lib/rainbows/rack_input.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-12-08 18:35:27 -0800
committerEric Wong <normalperson@yhbt.net>2010-12-08 18:35:27 -0800
commit6b750f5f952963009a2e6e8702fc8f3d8adc94ea (patch)
tree3debc215a179f416883aae3c02fd4ea4a4b5a322 /lib/rainbows/rack_input.rb
parent10d96a76a1ea4431dd10ba181d747169c22c1cec (diff)
downloadrainbows-6b750f5f952963009a2e6e8702fc8f3d8adc94ea.tar.gz
This was completely overlooked for the Rainbows 2.0.x
releases.
Diffstat (limited to 'lib/rainbows/rack_input.rb')
-rw-r--r--lib/rainbows/rack_input.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/rainbows/rack_input.rb b/lib/rainbows/rack_input.rb
new file mode 100644
index 0000000..df51ac1
--- /dev/null
+++ b/lib/rainbows/rack_input.rb
@@ -0,0 +1,17 @@
+# -*- 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, client)
+    env[RACK_INPUT] = 0 == hp.content_length ? NULL_IO : IC.new(client, hp)
+    env[CLIENT_IO] = client
+  end
+end