From 630501f6214a8d44bd2e7a5ae43badf2c0e093f8 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 5 Nov 2009 01:31:44 -0800 Subject: ev_core: remove Tempfile usage once again We're simply too uncomfortable with the weird GC issues associated with Tempfile and having linked temporary files at all. Instead just depend on the #size-aware TmpIO class that Unicorn 0.94.0 provides for us. --- lib/rainbows/ev_core.rb | 7 ++----- rainbows.gemspec | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/rainbows/ev_core.rb b/lib/rainbows/ev_core.rb index f90e1e1..2679b5a 100644 --- a/lib/rainbows/ev_core.rb +++ b/lib/rainbows/ev_core.rb @@ -1,7 +1,5 @@ # -*- encoding: binary -*- -require 'tempfile' - module Rainbows # base module for evented models like Rev and EventMachine @@ -56,8 +54,7 @@ module Rainbows write(EXPECT_100_RESPONSE) @env.delete(HTTP_EXPECT) end - @input = len && len <= MAX_BODY ? - StringIO.new("") : Tempfile.new(nil).binmode + @input = len && len <= MAX_BODY ? StringIO.new("") : Util.tmpio @hp.filter_body(@buf2 = @buf.dup, @buf) @input << @buf2 on_read("") @@ -74,7 +71,7 @@ module Rainbows when :trailers if @hp.trailers(@env, @buf << data) app_call - @input.close! if Tempfile === @input + @input.close if File === @input end end rescue Object => e diff --git a/rainbows.gemspec b/rainbows.gemspec index dea8603..9237dfc 100644 --- a/rainbows.gemspec +++ b/rainbows.gemspec @@ -41,7 +41,7 @@ Gem::Specification.new do |s| s.test_files = test_files # we need Unicorn for the HTTP parser and process management - s.add_dependency(%q, ["~> 0.93.5"]) + s.add_dependency(%q, ["~> 0.94.0"]) # Unicorn already depends on Rack # s.add_dependency(%q) -- cgit v1.2.3-24-ge0c7