diff options
author | Carlhuda <carlhuda@engineyard.com> | 2010-02-23 17:03:06 -0800 |
---|---|---|
committer | Carlhuda <carlhuda@engineyard.com> | 2010-02-23 17:06:35 -0800 |
commit | 5e2bd08023344f3fd4675e80203a10967ffe9000 (patch) | |
tree | 4e1b647bba47175b6ab9d0f054d4baba2224e221 /actionpack/lib/action_controller/railties | |
parent | a73f682e43016de520510e015802c48c9947a05c (diff) | |
download | rails-5e2bd08023344f3fd4675e80203a10967ffe9000.tar.gz rails-5e2bd08023344f3fd4675e80203a10967ffe9000.tar.bz2 rails-5e2bd08023344f3fd4675e80203a10967ffe9000.zip |
Makes send_file work again by deferring to Rack::Sendfile.
* Add the Rack::Sendfile middleware
* Make the header to use configurable via config.action_dispatch.x_sendfile_header (default to "X-Sendfile").
* Add Railties tests to confirm that these work
* Remove the :stream, :buffer_size, and :x_senfile default options to send_file
* Change the log subscriber to always say "Sent file"
* Add deprecation warnings for options that are now no-ops
Note that servers can configure this by setting X-Sendfile-Type. Hosting companies and those creating packages of servers specially designed for Rails applications are encouraged to specify this header so that this can work transparently.
Diffstat (limited to 'actionpack/lib/action_controller/railties')
-rw-r--r-- | actionpack/lib/action_controller/railties/log_subscriber.rb | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/actionpack/lib/action_controller/railties/log_subscriber.rb b/actionpack/lib/action_controller/railties/log_subscriber.rb index df9ffa1717..c2299d0b05 100644 --- a/actionpack/lib/action_controller/railties/log_subscriber.rb +++ b/actionpack/lib/action_controller/railties/log_subscriber.rb @@ -22,15 +22,7 @@ module ActionController end def send_file(event) - message = if event.payload[:x_sendfile] - header = ActionController::Streaming::X_SENDFILE_HEADER - "Sent #{header} header %s" - elsif event.payload[:stream] - "Streamed file %s" - else - "Sent file %s" - end - + message = "Sent file %s" message << " (%.1fms)" info(message % [event.payload[:path], event.duration]) end |