diff --git a/vendor/rails/actionpack/lib/action_controller/dispatcher.rb b/vendor/rails/actionpack/lib/action_controller/dispatcher.rb index 2d5e80f..c52b6a1 100644 --- a/vendor/rails/actionpack/lib/action_controller/dispatcher.rb +++ b/vendor/rails/actionpack/lib/action_controller/dispatcher.rb @@ -54,13 +54,19 @@ module ActionController end # If the block raises, send status code as a last-ditch response. - def failsafe_response(fallback_output, status, originating_exception = nil) + def failsafe_response(fallback_output, status, originating_exception = nil, response = nil) yield rescue Exception => exception begin log_failsafe_exception(status, originating_exception || exception) body = failsafe_response_body(status) - fallback_output.write "Status: #{status}\r\nContent-Type: text/html\r\n\r\n#{body}" + if false # response + response.headers['Status'] = status + response.body = body + response.out(fallback_output) + else + fallback_output.write "Status: #{status}\r\nContent-Type: text/html\r\n\r\n#{body}" + end nil rescue Exception => failsafe_error # Logger or IO errors $stderr.puts "Error during failsafe response: #{failsafe_error}" @@ -184,7 +190,7 @@ module ActionController end def failsafe_rescue(exception) - self.class.failsafe_response(@output, '500 Internal Server Error', exception) do + self.class.failsafe_response(@output, '500 Internal Server Error', exception, @response) do if @controller ||= defined?(::ApplicationController) ? ::ApplicationController : Base @controller.process_with_exception(@request, @response, exception).out(@output) else