diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-03 12:32:14 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-03 12:32:14 +0200 |
commit | e1c16850168fbadc5ae8a0688e23170021a84955 (patch) | |
tree | fe56bef3d06b05dcebcca8d5a323bcb88e355889 /actionpack/lib/action_dispatch | |
parent | ed3e667415e191d1677a3b7e55b077f55504214c (diff) | |
download | rails-e1c16850168fbadc5ae8a0688e23170021a84955.tar.gz rails-e1c16850168fbadc5ae8a0688e23170021a84955.tar.bz2 rails-e1c16850168fbadc5ae8a0688e23170021a84955.zip |
Static middleware accepts cache control.
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/static.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/static.rb b/actionpack/lib/action_dispatch/middleware/static.rb index 348f7b86b8..360c1209bb 100644 --- a/actionpack/lib/action_dispatch/middleware/static.rb +++ b/actionpack/lib/action_dispatch/middleware/static.rb @@ -2,10 +2,10 @@ require 'rack/utils' module ActionDispatch class FileHandler - def initialize(root) + def initialize(root, cache_control) @root = root.chomp('/') @compiled_root = /^#{Regexp.escape(root)}/ - @file_server = ::Rack::File.new(@root) + @file_server = ::Rack::File.new(@root, cache_control) end def match?(path) @@ -37,9 +37,9 @@ module ActionDispatch class Static FILE_METHODS = %w(GET HEAD).freeze - def initialize(app, path) + def initialize(app, path, cache_control=nil) @app = app - @file_handler = FileHandler.new(path) + @file_handler = FileHandler.new(path, cache_control) end def call(env) |