aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-05-23 10:27:46 +0200
committerJosé Valim <jose.valim@gmail.com>2011-05-23 10:28:00 +0200
commit6e5eedeb127f5bf9faf95460569931229a153cec (patch)
tree598f590567f6f97af18c677c9b95eb8b6650d872
parentc944cab6cec752c5c5582c5e351dd98d0619aa7a (diff)
downloadrails-6e5eedeb127f5bf9faf95460569931229a153cec.tar.gz
rails-6e5eedeb127f5bf9faf95460569931229a153cec.tar.bz2
rails-6e5eedeb127f5bf9faf95460569931229a153cec.zip
Move content length to the server, this brings the same behavior as in rack 1.2.
-rw-r--r--railties/lib/rails/application.rb2
-rw-r--r--railties/lib/rails/commands/server.rb1
-rw-r--r--railties/test/application/middleware_test.rb13
3 files changed, 7 insertions, 9 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb
index a7405aae16..99527bb051 100644
--- a/railties/lib/rails/application.rb
+++ b/railties/lib/rails/application.rb
@@ -141,8 +141,6 @@ module Rails
def default_middleware_stack
ActionDispatch::MiddlewareStack.new.tap do |middleware|
- middleware.use ::Rails::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
diff --git a/railties/lib/rails/commands/server.rb b/railties/lib/rails/commands/server.rb
index 505a4ca2bd..91c87514cf 100644
--- a/railties/lib/rails/commands/server.rb
+++ b/railties/lib/rails/commands/server.rb
@@ -78,6 +78,7 @@ module Rails
middlewares = []
middlewares << [Rails::Rack::LogTailer, log_path] unless options[:daemonize]
middlewares << [Rails::Rack::Debugger] if options[:debugger]
+ middlewares << [Rails::Rack::ContentLength]
Hash.new(middlewares)
end
diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb
index ef448f7791..715798ca08 100644
--- a/railties/test/application/middleware_test.rb
+++ b/railties/test/application/middleware_test.rb
@@ -19,7 +19,6 @@ module ApplicationTests
boot!
assert_equal [
- "Rails::Rack::ContentLength",
"ActionDispatch::Static",
"Rack::Lock",
"ActiveSupport::Cache::Strategy::LocalCache",
@@ -49,7 +48,7 @@ module ApplicationTests
boot!
- assert_equal "Rack::Cache", middleware.second
+ assert_equal "Rack::Cache", middleware.first
end
test "Rack::SSL is present when force_ssl is set" do
@@ -104,7 +103,7 @@ module ApplicationTests
end
test "insert middleware after" do
- add_to_config "config.middleware.insert_after Rails::Rack::ContentLength, Rack::Config"
+ add_to_config "config.middleware.insert_after ActionDispatch::Static, Rack::Config"
boot!
assert_equal "Rack::Config", middleware.second
end
@@ -112,12 +111,12 @@ module ApplicationTests
test "RAILS_CACHE does not respond to middleware" do
add_to_config "config.cache_store = :memory_store"
boot!
- assert_equal "Rack::Runtime", middleware.fourth
+ assert_equal "Rack::Runtime", middleware.third
end
test "RAILS_CACHE does respond to middleware" do
boot!
- assert_equal "Rack::Runtime", middleware.fifth
+ assert_equal "Rack::Runtime", middleware.fourth
end
test "identity map is inserted" do
@@ -127,7 +126,7 @@ module ApplicationTests
end
test "insert middleware before" do
- add_to_config "config.middleware.insert_before Rails::Rack::ContentLength, Rack::Config"
+ add_to_config "config.middleware.insert_before ActionDispatch::Static, Rack::Config"
boot!
assert_equal "Rack::Config", middleware.first
end
@@ -201,4 +200,4 @@ module ApplicationTests
AppTemplate::Application.middleware.map(&:klass).map(&:name)
end
end
-end
+end \ No newline at end of file