globally refactor Range handling for responses
[rainbows.git] / lib / rainbows / rack_input.rb
blobbc68ed1d9655da69fbb045e543d4b0d2110f45aa
1 # -*- encoding: binary -*-
2 # :enddoc:
3 # only used by synchronous interfaces
4 module Rainbows::RackInput
5   NULL_IO = Unicorn::HttpRequest::NULL_IO
6   RACK_INPUT = Unicorn::HttpRequest::RACK_INPUT
7   CLIENT_IO = Rainbows::Const::CLIENT_IO
9   def self.setup
10     const_set(:IC, Unicorn::HttpRequest.input_class)
11   end
13   def set_input(env, hp)
14     env[RACK_INPUT] = 0 == hp.content_length ? NULL_IO : IC.new(self, hp)
15     env[CLIENT_IO] = self
16   end
17 end