Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ensuring a HTTP Date header when setting Cache-Control's max-age with…

… #expires_in
  • Loading branch information...
commit 2a7230aa997b19971b39812893d79ca3f6c3bb47 1 parent 964b282
arvida authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  actionpack/lib/action_controller/metal/conditional_get.rb
View
3  actionpack/lib/action_controller/metal/conditional_get.rb
@@ -70,11 +70,14 @@ def stale?(options)
#
# This method will overwrite an existing Cache-Control header.
# See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html for more possibilities.
+ #
+ # The method will also ensure a HTTP Date header for client compatibility.
def expires_in(seconds, options = {}) #:doc:
response.cache_control.merge!(:max_age => seconds, :public => options.delete(:public))
options.delete(:private)
response.cache_control[:extras] = options.map {|k,v| "#{k}=#{v}"}
+ response.date = Time.now unless response.date?
end
# Sets a HTTP 1.1 Cache-Control header of <tt>no-cache</tt> so no caching should occur by the browser or
Please sign in to comment.
Something went wrong with that request. Please try again.