From 313b0236c03eebd9f8074b11ff0b1778e22a87d4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 11 May 2015 23:58:08 +0000 Subject: proxy_pass: no point in closing StringIO It does not release memory immediately and GC can handle it reliably, so don't waste a constant lookup + cache entry on it. While we're at it, explain why we can't do a simpler respond_to? check instead. --- lib/yahns/proxy_pass.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/yahns/proxy_pass.rb b/lib/yahns/proxy_pass.rb index 7bbab51..15c9f53 100644 --- a/lib/yahns/proxy_pass.rb +++ b/lib/yahns/proxy_pass.rb @@ -149,8 +149,10 @@ class Yahns::ProxyPass # :nodoc: end def close_req_body(input) + # we cannot use respond_to?(:close) here since Rack::Lint::InputWrapper + # tries to prevent that (and hijack means all Rack specs go out the door) case input - when Yahns::TeeInput, IO, StringIO + when Yahns::TeeInput, IO input.close end end -- cgit v1.2.3-24-ge0c7