about summary refs log tree commit homepage
path: root/lib/unicorn/http_request.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-11-11 02:16:50 +0800
committerEric Wong <normalperson@yhbt.net>2010-11-11 07:18:20 +0800
commita89ccf321224f3248ddd00bb0edb320311604e4e (patch)
tree669d6af1eee6c70d72bdeba6f77d9a7114cf54ed /lib/unicorn/http_request.rb
parent7d44b5384758aeddcb49d7606a9908308df7c698 (diff)
downloadunicorn-a89ccf321224f3248ddd00bb0edb320311604e4e.tar.gz
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.
Diffstat (limited to 'lib/unicorn/http_request.rb')
-rw-r--r--lib/unicorn/http_request.rb13
1 files changed, 11 insertions, 2 deletions
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