Permalink
Browse files

Use Rack::ContentLength.

  • Loading branch information...
1 parent 2c08a74 commit e4ebded5bcd4f54fee0c4f643c9df76aeb22436e @josevalim josevalim committed May 19, 2011
Showing with 8 additions and 5 deletions.
  1. +2 −0 railties/lib/rails/application.rb
  2. +6 −5 railties/test/application/middleware_test.rb
@@ -141,6 +141,8 @@ def config
def default_middleware_stack
ActionDispatch::MiddlewareStack.new.tap do |middleware|
+ middleware.use ::Rack::ContentLength, config.action_dispatch.x_sendfile_header
+
if rack_cache = config.action_controller.perform_caching && config.action_dispatch.rack_cache
require "action_dispatch/http/rack_cache"
middleware.use ::Rack::Cache, rack_cache
@@ -19,6 +19,7 @@ def app
boot!
assert_equal [
+ "Rack::ContentLength",
"ActionDispatch::Static",
"Rack::Lock",
"ActiveSupport::Cache::Strategy::LocalCache",
@@ -48,7 +49,7 @@ def app
boot!
- assert_equal "Rack::Cache", middleware.first
+ assert_equal "Rack::Cache", middleware.second
end
test "Rack::SSL is present when force_ssl is set" do
@@ -103,20 +104,20 @@ def app
end
test "insert middleware after" do
- add_to_config "config.middleware.insert_after ActionDispatch::Static, Rack::Config"
+ add_to_config "config.middleware.insert_after Rack::ContentLength, Rack::Config"
boot!
assert_equal "Rack::Config", middleware.second
end
test "RAILS_CACHE does not respond to middleware" do
add_to_config "config.cache_store = :memory_store"
boot!
- assert_equal "Rack::Runtime", middleware.third
+ assert_equal "Rack::Runtime", middleware.fourth
end
test "RAILS_CACHE does respond to middleware" do
boot!
- assert_equal "Rack::Runtime", middleware.fourth
+ assert_equal "Rack::Runtime", middleware.fifth
end
test "identity map is inserted" do
@@ -126,7 +127,7 @@ def app
end
test "insert middleware before" do
- add_to_config "config.middleware.insert_before ActionDispatch::Static, Rack::Config"
+ add_to_config "config.middleware.insert_before Rack::ContentLength, Rack::Config"
boot!
assert_equal "Rack::Config", middleware.first
end

1 comment on commit e4ebded

@arunagw
Member

@josh I think you need to revert this also as this reverted rack/rack@bc30108

Please sign in to comment.