diff options
author | José Valim <jose.valim@gmail.com> | 2010-05-29 22:29:14 +0200 |
---|---|---|
committer | Mikel Lindsaar <raasdnil@gmail.com> | 2010-06-03 23:32:10 +1000 |
commit | 2740943634fe151fb3fb87e2af7881a93f5dd6b5 (patch) | |
tree | 4916366ccf706c49f7e2082a406a2a90471dff79 /railties/lib/rails/application | |
parent | 27939bd753b79c8205d1d3c1cdc7db6205642302 (diff) | |
download | rails-2740943634fe151fb3fb87e2af7881a93f5dd6b5.tar.gz rails-2740943634fe151fb3fb87e2af7881a93f5dd6b5.tar.bz2 rails-2740943634fe151fb3fb87e2af7881a93f5dd6b5.zip |
Remove the laziness from the middleware stack.
Diffstat (limited to 'railties/lib/rails/application')
-rw-r--r-- | railties/lib/rails/application/bootstrap.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/application/configuration.rb | 28 |
2 files changed, 3 insertions, 27 deletions
diff --git a/railties/lib/rails/application/bootstrap.rb b/railties/lib/rails/application/bootstrap.rb index e62eed8a87..0a435f0f36 100644 --- a/railties/lib/rails/application/bootstrap.rb +++ b/railties/lib/rails/application/bootstrap.rb @@ -47,7 +47,7 @@ module Rails silence_warnings { Object.const_set "RAILS_CACHE", ActiveSupport::Cache.lookup_store(config.cache_store) } if RAILS_CACHE.respond_to?(:middleware) - config.middleware.insert_after(:"Rack::Lock", RAILS_CACHE.middleware) + config.middleware.insert_before("Rack::Runtime", RAILS_CACHE.middleware) end end end diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index f3a326f36d..25e54e9dce 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -9,7 +9,7 @@ module Rails attr_accessor :allow_concurrency, :cache_classes, :cache_store, :encoding, :consider_all_requests_local, :dependency_loading, - :filter_parameters, :log_level, :logger, + :filter_parameters, :log_level, :logger, :middleware, :plugins, :preload_frameworks, :reload_engines, :reload_plugins, :secret_token, :serve_static_assets, :session_options, :time_zone, :whiny_nils @@ -25,6 +25,7 @@ module Rails @session_store = :cookie_store @session_options = {} @time_zone = "UTC" + @middleware = app_middleware end def encoding=(value) @@ -41,10 +42,6 @@ module Rails end end - def middleware - @middleware ||= app_middleware.merge_into(default_middleware_stack) - end - def paths @paths ||= begin paths = super @@ -134,27 +131,6 @@ module Rails @session_options = args.shift || {} end end - - protected - - def default_middleware_stack - ActionDispatch::MiddlewareStack.new.tap do |middleware| - middleware.use('::ActionDispatch::Static', lambda { paths.public.to_a.first }, :if => lambda { serve_static_assets }) - middleware.use('::Rack::Lock', :if => lambda { !allow_concurrency }) - middleware.use('::Rack::Runtime') - middleware.use('::Rails::Rack::Logger') - middleware.use('::ActionDispatch::ShowExceptions', lambda { consider_all_requests_local }, :if => lambda { action_dispatch.show_exceptions }) - middleware.use('::ActionDispatch::RemoteIp', lambda { action_dispatch.ip_spoofing_check }, lambda { action_dispatch.trusted_proxies }) - middleware.use('::Rack::Sendfile', lambda { action_dispatch.x_sendfile_header }) - middleware.use('::ActionDispatch::Callbacks', lambda { !cache_classes }) - middleware.use('::ActionDispatch::Cookies') - middleware.use(lambda { session_store }, lambda { session_options }) - middleware.use('::ActionDispatch::Flash', :if => lambda { session_store }) - middleware.use('::ActionDispatch::ParamsParser') - middleware.use('::Rack::MethodOverride') - middleware.use('::ActionDispatch::Head') - end - end end end end |