about summary refs log tree commit homepage
path: root/lib/unicorn/http_server.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_server.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_server.rb')
-rw-r--r--lib/unicorn/http_server.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index 69b7cc8..f0dca7c 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -355,6 +355,15 @@ class Unicorn::HttpServer
     kill_each_worker(:KILL)
   end
 
+  def rewindable_input
+    Unicorn::HttpRequest.input_class.method_defined?(:rewind)
+  end
+
+  def rewindable_input=(bool)
+    Unicorn::HttpRequest.input_class = bool ?
+                                Unicorn::TeeInput : Unicorn::StreamInput
+  end
+
   private
 
   # wait for a signal hander to wake us up and then consume the pipe