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/lib/action_controller/cgi_process.rb | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'actionpack/lib/action_controller/cgi_process.rb') 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