Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make dispatcher instances immutable

  • Loading branch information...
commit c2511f936e0129cde898e059391aeaca5a3f238b 1 parent d775103
Joshua Peek josh authored wycats committed
Showing with 14 additions and 3 deletions.
  1. +14 −3 actionpack/lib/action_controller/dispatch/dispatcher.rb
17 actionpack/lib/action_controller/dispatch/dispatcher.rb
View
@@ -66,7 +66,8 @@ def cleanup_application
define_callbacks :prepare_dispatch, :before_dispatch, :after_dispatch
def initialize
- @app = @@middleware.build(lambda { |env| self.dup._call(env) })
+ @app = @@middleware.build(lambda { |env| self._call(env) })
+ freeze
end
def call(env)
@@ -74,8 +75,18 @@ def call(env)
end
def _call(env)
- @env = env
- dispatch
+ begin
+ run_callbacks :before_dispatch
+ Routing::Routes.call(env)
+ rescue Exception => exception
+ if controller ||= (::ApplicationController rescue Base)
+ controller.call_with_exception(env, exception).to_a
+ else
+ raise exception
+ end
+ ensure
+ run_callbacks :after_dispatch, :enumerator => :reverse_each
+ end
end
def flush_logger

4 comments on commit c2511f9

Eloy Durán

It’s a bit hard to follow the history how this relates to c1b4a5eb564f8fdd71307efeb5ee729cc6f20059.

Second, where are the tests?

Joshua Peek
Collaborator

Weird git merge issue. I was pretty sure this diff was committed w/ c1b4a5eb.

This is related to removing CGI support. There are no new apis or features we are adding, nothing additional to test.

Joshua Peek
Collaborator

Ah, here is the real commit: c1b4a5eb564f8fdd71307efeb5ee729cc6f20059

Eloy Durán

Thanks for clarifying!

Please sign in to comment.
Something went wrong with that request. Please try again.