<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,7 @@
 *2.3.0 [Edge]*
 
+* Fixed that send_file shouldn't set an etag #1578 [Hongli Lai]
+
 * Allow users to opt out of the spoofing checks in Request#remote_ip.  Useful for sites whose traffic regularly triggers false positives. [Darren Boyd]
 
 * Deprecated formatted_polymorphic_url.  [Jeremy Kemper]</diff>
      <filename>actionpack/CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -115,7 +115,11 @@ module ActionController # :nodoc:
     end
     
     def etag=(etag)
-      headers['ETag'] = %(&quot;#{Digest::MD5.hexdigest(ActiveSupport::Cache.expand_cache_key(etag))}&quot;)
+      if etag.blank?
+        headers.delete('ETag')
+      else
+        headers['ETag'] = %(&quot;#{Digest::MD5.hexdigest(ActiveSupport::Cache.expand_cache_key(etag))}&quot;)
+      end
     end
 
     def redirect(url, status)</diff>
      <filename>actionpack/lib/action_controller/response.rb</filename>
    </modified>
    <modified>
      <diff>@@ -208,6 +208,10 @@ class TestController &lt; ActionController::Base
   def greeting
     # let's just rely on the template
   end
+  
+  def blank_response
+    render :text =&gt; ' '
+  end
 
   def layout_test
     render :action =&gt; &quot;hello_world&quot;
@@ -1380,6 +1384,11 @@ class EtagRenderTest &lt; ActionController::TestCase
     @request.host = &quot;www.nextangle.com&quot;
     @expected_bang_etag = etag_for(expand_key([:foo, 123]))
   end
+  
+  def test_render_blank_body_shouldnt_set_etag
+    get :blank_response
+    assert !@response.etag?
+  end
 
   def test_render_200_should_set_etag
     get :render_hello_world_from_variable</diff>
      <filename>actionpack/test/controller/render_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -69,6 +69,7 @@ class SendFileTest &lt; Test::Unit::TestCase
 
     assert_equal @controller.file_path, response.headers['X-Sendfile']
     assert response.body.blank?
+    assert !response.etag?
   end
 
   def test_data</diff>
      <filename>actionpack/test/controller/send_file_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7c090509994faa19fcbd534aa78324b70b659627</id>
    </parent>
  </parents>
  <author>
    <name>Hongli Lai (Phusion</name>
    <email>hongli@phusion.nl</email>
  </author>
  <url>http://github.com/rails/rails/commit/9e2b4a10f7f091868b3c3701efb4c04048455706</url>
  <id>9e2b4a10f7f091868b3c3701efb4c04048455706</id>
  <committed-date>2008-12-16T03:30:28-08:00</committed-date>
  <authored-date>2008-12-15T12:36:33-08:00</authored-date>
  <message>Do not output an ETag header if response body is blank or when sending files with send_file(... :xsendfile =&gt; true) [#1578 state:committed]

Signed-off-by: David Heinemeier Hansson &lt;david@loudthinking.com&gt;</message>
  <tree>b7bfb7a80b78a22e5ab562a7d26c3d01abc7631d</tree>
  <committer>
    <name>David Heinemeier Hansson</name>
    <email>david@loudthinking.com</email>
  </committer>
</commit>
