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_server.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/unicorn/http_server.rb') 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 -- cgit v1.2.3-24-ge0c7