diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-10-03 14:21:31 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-10-03 14:21:31 -0700 |
commit | 24f9c03d52ad4c7f081cc7a9561946109b3ad500 (patch) | |
tree | 32545119b6321671e890e5c8139bbbf99729430f /railties/lib/rails | |
parent | 99392112c5367f0556225fd84f9e41da88e3277e (diff) | |
download | rails-24f9c03d52ad4c7f081cc7a9561946109b3ad500.tar.gz rails-24f9c03d52ad4c7f081cc7a9561946109b3ad500.tar.bz2 rails-24f9c03d52ad4c7f081cc7a9561946109b3ad500.zip |
Revert "removing Rack::Runtime from the default stack."
This reverts commit 37423e4ff883ad5584bab983aceb4b2b759a1fd8.
Jeremy is right that we shouldn't remove this. The fact is that many
engines are depending on this middleware to be in the default stack.
This ties our hands and forces us to keep the middleware in the stack so
that engines will work. To be extremely clear, I think this is another
smell of "the rack stack" that we have in place. When manipulating
middleware, we should have meaningful names for places in the req / res
lifecycle **not** have engines depend on a particular constant be in a
particular place in the stack. This is a weakness of the API that we
have to figure out a way to address before removing the constant.
As far as timing attacks are concerned, we can reduce the granularity
such that it isn't useful information for hackers, but is still useful
for developers.
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/application/bootstrap.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/application/default_middleware_stack.rb | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/railties/lib/rails/application/bootstrap.rb b/railties/lib/rails/application/bootstrap.rb index 85c282783b..9baf8aa742 100644 --- a/railties/lib/rails/application/bootstrap.rb +++ b/railties/lib/rails/application/bootstrap.rb @@ -63,7 +63,7 @@ INFO Rails.cache = ActiveSupport::Cache.lookup_store(config.cache_store) if Rails.cache.respond_to?(:middleware) - config.middleware.insert_before(::ActionDispatch::RequestId, Rails.cache.middleware) + config.middleware.insert_before(::Rack::Runtime, Rails.cache.middleware) end end end diff --git a/railties/lib/rails/application/default_middleware_stack.rb b/railties/lib/rails/application/default_middleware_stack.rb index b2185ca818..21062f3a53 100644 --- a/railties/lib/rails/application/default_middleware_stack.rb +++ b/railties/lib/rails/application/default_middleware_stack.rb @@ -47,6 +47,7 @@ module Rails end end + middleware.use ::Rack::Runtime middleware.use ::Rack::MethodOverride unless config.api_only middleware.use ::ActionDispatch::RequestId |