From 9e2b4a10f7f091868b3c3701efb4c04048455706 Mon Sep 17 00:00:00 2001 From: "Hongli Lai (Phusion" Date: Mon, 15 Dec 2008 21:36:33 +0100 Subject: 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 --- actionpack/lib/action_controller/response.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'actionpack/lib') 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) -- cgit v1.2.3