Permalink
Browse files

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
  • Loading branch information...
1 parent 3b2e356 commit b78283b3fcae6752e7f1698cc063eff6214d2104 @dhh dhh committed Mar 3, 2005
Showing with 14 additions and 7 deletions.
  1. +2 −0 actionpack/CHANGELOG
  2. +12 −7 actionpack/lib/action_controller/cgi_process.rb
View
@@ -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]
@@ -120,14 +120,19 @@ def out
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

0 comments on commit b78283b

Please sign in to comment.