From b78283b3fcae6752e7f1698cc063eff6214d2104 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 3 Mar 2005 23:12:57 +0000 Subject: Fixed that broken pipe errors (clients disconnecting in mid-request) could bring down a fcgi process git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@829 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/CHANGELOG | 2 ++ actionpack/lib/action_controller/cgi_process.rb | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) (limited to 'actionpack') diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 156c41a098..b901012044 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fixed that broken pipe errors (clients disconnecting in mid-request) could bring down a fcgi process + * Added the original exception message to session recall errors (so you can see which class wasnt required) * Fixed that RAILS_ROOT might not be defined when AP was loaded, so do a late initialization of the ROUTE_FILE #761 [Scott Barron] diff --git a/actionpack/lib/action_controller/cgi_process.rb b/actionpack/lib/action_controller/cgi_process.rb index 5900540b80..4e3a1d270c 100644 --- a/actionpack/lib/action_controller/cgi_process.rb +++ b/actionpack/lib/action_controller/cgi_process.rb @@ -120,14 +120,19 @@ module ActionController #:nodoc: convert_content_type!(@headers) $stdout.binmode if $stdout.respond_to?(:binmode) $stdout.sync = false - print @cgi.header(@headers) + + begin + print @cgi.header(@headers) - if @cgi.send(:env_table)['REQUEST_METHOD'] == 'HEAD' - return - elsif @body.respond_to?(:call) - @body.call(self) - else - print @body + if @cgi.send(:env_table)['REQUEST_METHOD'] == 'HEAD' + return + elsif @body.respond_to?(:call) + @body.call(self) + else + print @body + end + rescue Errno::EPIPE => e + # lost connection to the FCGI process -- ignore the output, then end end -- cgit v1.2.3