Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7309

Show
Ignore:
Timestamp:
08/12/07 22:32:19 (11 months ago)
Author:
nzkoz
Message:

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.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/response.rb

    r6350 r7309  
    4747        if body.is_a?(String) && (headers['Status'] ? headers['Status'][0..2] == '200' : true)  && !body.empty? 
    4848          self.headers['ETag'] ||= %("#{Digest::MD5.hexdigest(body)}") 
    49           self.headers['Cache-Control'] = 'private' if headers['Cache-Control'] == DEFAULT_HEADERS['Cache-Control'] 
     49          self.headers['Cache-Control'] = 'private, max-age=0, must-revalidate' if headers['Cache-Control'] == DEFAULT_HEADERS['Cache-Control'] 
    5050 
    5151          if request.headers['HTTP_IF_NONE_MATCH'] == headers['ETag'] 
  • trunk/actionpack/test/controller/render_test.rb

    r7190 r7309  
    321321    get :render_hello_world_from_variable 
    322322    assert_equal etag_for("hello david"), @response.headers['ETag'] 
     323    assert_equal "private, max-age=0, must-revalidate", @response.headers['Cache-Control'] 
    323324  end 
    324325