aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-03-03 23:12:57 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-03-03 23:12:57 +0000
commitb78283b3fcae6752e7f1698cc063eff6214d2104 (patch)
tree533e647e3de4190e428f71ceae5943e29b399737 /actionpack
parent3b2e356cd2d168c40c60015ee059070767f1fd7e (diff)
downloadrails-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')
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_controller/cgi_process.rb19
2 files changed, 14 insertions, 7 deletions
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