From c071123b3e2d6fd918dd7e419efe7429355445c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20S=C3=B8rensen?= Date: Fri, 6 Mar 2009 10:17:20 +0100 Subject: Ensure expires_in without a :public key sets the Cache-Control header to private. [#2095 state:resolved] This fixes a regression introduced in f2a32bd0, which wasn't exposed due to two test methods having the same name. Signed-off-by: Pratik Naik --- actionpack/lib/action_controller/base.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_controller/base.rb') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 5da47ce317..9d06d052b4 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -1205,10 +1205,12 @@ module ActionController #:nodoc: cache_control = response.headers["Cache-Control"].split(",").map {|k| k.strip } cache_control << "max-age=#{seconds}" + cache_control.delete("no-cache") if options[:public] cache_control.delete("private") - cache_control.delete("no-cache") cache_control << "public" + else + cache_control << "private" end # This allows for additional headers to be passed through like 'max-stale' => 5.hours -- cgit v1.2.3