From a89ccf321224f3248ddd00bb0edb320311604e4e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 11 Nov 2010 02:16:50 +0800 Subject: configurator: enable "rewindable_input" directive This allows users to override the current Rack spec and disable the rewindable input requirement. This can allow applications to use less I/O to minimize the performance impact when processing uploads. --- lib/unicorn/http_request.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib/unicorn/http_request.rb') diff --git a/lib/unicorn/http_request.rb b/lib/unicorn/http_request.rb index 2dcd839..1e3ac26 100644 --- a/lib/unicorn/http_request.rb +++ b/lib/unicorn/http_request.rb @@ -25,7 +25,15 @@ class Unicorn::HttpParser # A frozen format for this is about 15% faster REMOTE_ADDR = 'REMOTE_ADDR'.freeze RACK_INPUT = 'rack.input'.freeze - TeeInput = Unicorn::TeeInput + @@input_class = Unicorn::TeeInput + + def self.input_class + @@input_class + end + + def self.input_class=(klass) + @@input_class = klass + end # :startdoc: # Does the majority of the IO processing. It has been written in @@ -63,7 +71,8 @@ class Unicorn::HttpParser buf << socket.kgio_read!(16384) end while parse.nil? end - e[RACK_INPUT] = 0 == content_length ? NULL_IO : TeeInput.new(socket, self) + e[RACK_INPUT] = 0 == content_length ? + NULL_IO : @@input_class.new(socket, self) e.merge!(DEFAULTS) end end -- cgit v1.2.3-24-ge0c7