aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2005-11-01 18:29:41 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2005-11-01 18:29:41 +0000
commit144f78be41c91553a6a4761f0b3c5c5ead699622 (patch)
tree6c9dfe3317e5d6551e33a65f6106c923cf9ab88a /railties
parent30b9d6d28a946f37cd41e9dad50fb7c9224dac6d (diff)
downloadrails-144f78be41c91553a6a4761f0b3c5c5ead699622.tar.gz
rails-144f78be41c91553a6a4761f0b3c5c5ead699622.tar.bz2
rails-144f78be41c91553a6a4761f0b3c5c5ead699622.zip
Move Dispatcher.dispatch CGI.new out of default args and into rescuable block so the dispatcher catches its errors rather than the fcgi handler.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2839 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/lib/dispatcher.rb24
2 files changed, 14 insertions, 12 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index c6914af35c..48ff33608e 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Move Dispatcher.dispatch CGI.new out of default args and into rescuable block so the dispatcher catches its errors rather than the fcgi handler. [Jeremy Kemper]
+
* The freeze_gems Rake task accepts the VERSION environment variable to decide which version of Rails to pull into vendor/rails. [Chad Fowler, Jeremy Kemper]
* Removed script.aculo.us.js, builder.js and slider.js (preperation for move of scriptaculous extensions to plugins, core scriptaculous will remain in Railties) [Thomas Fuchs]
diff --git a/railties/lib/dispatcher.rb b/railties/lib/dispatcher.rb
index a3382b3fc6..73bedf5ecf 100644
--- a/railties/lib/dispatcher.rb
+++ b/railties/lib/dispatcher.rb
@@ -26,19 +26,19 @@
# the environment (when Dependencies.load? is true) after each request.
class Dispatcher
class << self
-
+
# Dispatch the given CGI request, using the given session options, and
- # emitting the output via the given output.
- def dispatch(cgi = CGI.new, session_options = ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, output = $stdout)
- begin
- request, response = ActionController::CgiRequest.new(cgi, session_options), ActionController::CgiResponse.new(cgi)
- prepare_application
- ActionController::Routing::Routes.recognize!(request).process(request, response).out(output)
- rescue Object => exception
- ActionController::Base.process_with_exception(request, response, exception).out(output)
- ensure
- reset_after_dispatch
- end
+ # emitting the output via the given output. If you dispatch with your
+ # own CGI object, be sure to handle the exceptions it raises.
+ def dispatch(cgi = nil, session_options = ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, output = $stdout)
+ cgi ||= CGI.new
+ request, response = ActionController::CgiRequest.new(cgi, session_options), ActionController::CgiResponse.new(cgi)
+ prepare_application
+ ActionController::Routing::Routes.recognize!(request).process(request, response).out(output)
+ rescue Object => exception
+ ActionController::Base.process_with_exception(request, response, exception).out(output)
+ ensure
+ reset_after_dispatch
end
# Reset the application by clearing out loaded controllers, views, actions,