aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2016-01-12 12:25:05 +1030
committerMatthew Draper <matthew@trebex.net>2016-01-12 12:25:05 +1030
commit5eef308561b359c717b44e6d2f124100424a71a0 (patch)
tree965424fdf3c4c069a6736a37a2c5debef41c5cf1 /actionpack/lib/action_dispatch
parentddfd51f270a9d915c64e83f73390c8642de44e23 (diff)
parent272c5838dfed0473acc11a9f97d797180015b242 (diff)
downloadrails-5eef308561b359c717b44e6d2f124100424a71a0.tar.gz
rails-5eef308561b359c717b44e6d2f124100424a71a0.tar.bz2
rails-5eef308561b359c717b44e6d2f124100424a71a0.zip
Merge pull request #23020 from matthewd/frozen-headers
Commit before freezing the headers
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/http/cache.rb2
-rw-r--r--actionpack/lib/action_dispatch/http/response.rb7
2 files changed, 8 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/http/cache.rb b/actionpack/lib/action_dispatch/http/cache.rb
index 30ade14c26..842dfa5827 100644
--- a/actionpack/lib/action_dispatch/http/cache.rb
+++ b/actionpack/lib/action_dispatch/http/cache.rb
@@ -91,7 +91,7 @@ module ActionDispatch
DATE = 'Date'.freeze
LAST_MODIFIED = "Last-Modified".freeze
- SPECIAL_KEYS = Set.new(%w[extras no-cache max-age public must-revalidate])
+ SPECIAL_KEYS = Set.new(%w[extras no-cache max-age public private must-revalidate])
def cache_control_segments
if cache_control = _cache_control
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb
index 9b11111a67..b426d272f2 100644
--- a/actionpack/lib/action_dispatch/http/response.rb
+++ b/actionpack/lib/action_dispatch/http/response.rb
@@ -412,6 +412,13 @@ module ActionDispatch # :nodoc:
end
def before_sending
+ # Normally we've already committed by now, but it's possible
+ # (e.g., if the controller action tries to read back its own
+ # response) to get here before that. In that case, we must force
+ # an "early" commit: we're about to freeze the headers, so this is
+ # our last chance.
+ commit! unless committed?
+
headers.freeze
request.commit_cookie_jar! unless committed?
end