diff options
author | Hongli Lai (Phusion <hongli@phusion.nl> | 2008-12-15 21:36:33 +0100 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-12-16 12:30:28 +0100 |
commit | 9e2b4a10f7f091868b3c3701efb4c04048455706 (patch) | |
tree | b7bfb7a80b78a22e5ab562a7d26c3d01abc7631d /actionpack/lib | |
parent | 7c090509994faa19fcbd534aa78324b70b659627 (diff) | |
download | rails-9e2b4a10f7f091868b3c3701efb4c04048455706.tar.gz rails-9e2b4a10f7f091868b3c3701efb4c04048455706.tar.bz2 rails-9e2b4a10f7f091868b3c3701efb4c04048455706.zip |
Do not output an ETag header if response body is blank or when sending files with send_file(... :xsendfile => true) [#1578 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/response.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/response.rb b/actionpack/lib/action_controller/response.rb index 559c38efd0..4c37f09215 100644 --- a/actionpack/lib/action_controller/response.rb +++ b/actionpack/lib/action_controller/response.rb @@ -115,7 +115,11 @@ module ActionController # :nodoc: end def etag=(etag) - headers['ETag'] = %("#{Digest::MD5.hexdigest(ActiveSupport::Cache.expand_cache_key(etag))}") + if etag.blank? + headers.delete('ETag') + else + headers['ETag'] = %("#{Digest::MD5.hexdigest(ActiveSupport::Cache.expand_cache_key(etag))}") + end end def redirect(url, status) |