diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-03 23:12:57 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-03 23:12:57 +0000 |
commit | b78283b3fcae6752e7f1698cc063eff6214d2104 (patch) | |
tree | 533e647e3de4190e428f71ceae5943e29b399737 /actionpack/lib/action_controller/cgi_process.rb | |
parent | 3b2e356cd2d168c40c60015ee059070767f1fd7e (diff) | |
download | rails-b78283b3fcae6752e7f1698cc063eff6214d2104.tar.gz rails-b78283b3fcae6752e7f1698cc063eff6214d2104.tar.bz2 rails-b78283b3fcae6752e7f1698cc063eff6214d2104.zip |
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
Diffstat (limited to 'actionpack/lib/action_controller/cgi_process.rb')
-rw-r--r-- | actionpack/lib/action_controller/cgi_process.rb | 19 |
1 files changed, 12 insertions, 7 deletions
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 |