Permalink
Browse files

Send freshness information when sending Etags. Without this internet …

…explorer will not send conditional gets for a resource, but instead hold on to the responses for the current browser session.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7309 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 303d379 commit 55f444e69432aa9840406b3ad313eec39b6bbb87 @NZKoz NZKoz committed Aug 12, 2007
Showing with 2 additions and 1 deletion.
  1. +1 −1 actionpack/lib/action_controller/response.rb
  2. +1 −0 actionpack/test/controller/render_test.rb
@@ -46,7 +46,7 @@ def prepare!
def handle_conditional_get!
if body.is_a?(String) && (headers['Status'] ? headers['Status'][0..2] == '200' : true) && !body.empty?
self.headers['ETag'] ||= %("#{Digest::MD5.hexdigest(body)}")
- self.headers['Cache-Control'] = 'private' if headers['Cache-Control'] == DEFAULT_HEADERS['Cache-Control']
+ self.headers['Cache-Control'] = 'private, max-age=0, must-revalidate' if headers['Cache-Control'] == DEFAULT_HEADERS['Cache-Control']
if request.headers['HTTP_IF_NONE_MATCH'] == headers['ETag']
self.headers['Status'] = '304 Not Modified'
@@ -320,6 +320,7 @@ def test_accessing_local_assigns_in_inline_template_with_string_keys
def test_render_200_should_set_etag
get :render_hello_world_from_variable
assert_equal etag_for("hello david"), @response.headers['ETag']
+ assert_equal "private, max-age=0, must-revalidate", @response.headers['Cache-Control']
end
def test_render_against_etag_request_should_304_when_match

0 comments on commit 55f444e

Please sign in to comment.