summary refs log tree commit
diff options
context:
space:
mode:
authorJames Tucker <jftucker@gmail.com>2014-08-03 13:42:49 -0300
committerJames Tucker <jftucker@gmail.com>2014-08-03 13:42:49 -0300
commit0f8cd0544cf40ef91a55d7762bcbaf3a360f97f9 (patch)
tree0e0f2ab998e13edb2878b1a85ef791268e0c09ca
parent5a9ffeb77c613e3611262f1182284f1d7df393a8 (diff)
downloadrack-0f8cd0544cf40ef91a55d7762bcbaf3a360f97f9.tar.gz
Fix yet another body close bug in Rack::Deflater
-rw-r--r--lib/rack/deflater.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rack/deflater.rb b/lib/rack/deflater.rb
index 2e55f97e..36cfb7af 100644
--- a/lib/rack/deflater.rb
+++ b/lib/rack/deflater.rb
@@ -58,9 +58,9 @@ module Rack
       when "identity"
         [status, headers, body]
       when nil
-        body.close if body.respond_to?(:close)
         message = "An acceptable encoding for the requested resource #{request.fullpath} could not be found."
-        [406, {"Content-Type" => "text/plain", "Content-Length" => message.length.to_s}, [message]]
+        bp = Rack::BodyProxy.new([message]) { body.close if body.respond_to?(:close) }
+        [406, {"Content-Type" => "text/plain", "Content-Length" => message.length.to_s}, bp]
       end
     end