unwrap Upr::InputWrapper to detect a rewindable input
authorLunar <lunar@anargeek.net>
Mon, 27 Feb 2012 22:32:50 +0000 (23:32 +0100)
committerLunar <lunar@anargeek.net>
Thu, 14 Mar 2013 09:12:08 +0000 (10:12 +0100)
lib/coquelicot/rack/upload.rb

index ee9f71f..156334d 100644 (file)
@@ -32,7 +32,9 @@ module Coquelicot::Rack
 
     def call(env)
       if handle_request?(env)
-        if !@warned_of_rewind && env['rack.input'].respond_to?(:rewind)
+        input = env['rack.input']
+        input = input.input if input.is_a? Upr::InputWrapper
+        if !@warned_of_rewind && input.respond_to?(:rewind)
           env['rack.logger'].warn <<-MESSAGE.gsub(/\n */m, ' ').strip
             It looks like the input stream is "rewindable". This means that
             somewhere along the process, the input request is probably buffered,