From 0f8cd0544cf40ef91a55d7762bcbaf3a360f97f9 Mon Sep 17 00:00:00 2001 From: James Tucker Date: Sun, 3 Aug 2014 13:42:49 -0300 Subject: Fix yet another body close bug in Rack::Deflater --- lib/rack/deflater.rb | 4 ++-- 1 file 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 -- cgit v1.2.3-24-ge0c7