aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2018-06-19 08:52:16 -0400
committerGitHub <noreply@github.com>2018-06-19 08:52:16 -0400
commit2be5ef6a1d5baebcb749c42a48628c741570fd73 (patch)
treeb9274f359a069c26b999740125e62eb3f9d59750 /actionpack/lib/action_dispatch/http
parent433a3122697e41bb46c4f072d2d8223233af5dd4 (diff)
parentc94a00757dac150b17d9272b72288217c66f0a2d (diff)
downloadrails-2be5ef6a1d5baebcb749c42a48628c741570fd73.tar.gz
rails-2be5ef6a1d5baebcb749c42a48628c741570fd73.tar.bz2
rails-2be5ef6a1d5baebcb749c42a48628c741570fd73.zip
Merge pull request #33134 from dasch/dasch/extra-cache-controls
Add support for more HTTP cache controls
Diffstat (limited to 'actionpack/lib/action_dispatch/http')
-rw-r--r--actionpack/lib/action_dispatch/http/cache.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/http/cache.rb b/actionpack/lib/action_dispatch/http/cache.rb
index a8febc32b3..a7c7cfc1e5 100644
--- a/actionpack/lib/action_dispatch/http/cache.rb
+++ b/actionpack/lib/action_dispatch/http/cache.rb
@@ -202,13 +202,17 @@ module ActionDispatch
self._cache_control = _cache_control + ", #{control[:extras].join(', ')}"
end
else
- extras = control[:extras]
+ extras = control[:extras]
max_age = control[:max_age]
+ stale_while_revalidate = control[:stale_while_revalidate]
+ stale_if_error = control[:stale_if_error]
options = []
options << "max-age=#{max_age.to_i}" if max_age
options << (control[:public] ? PUBLIC : PRIVATE)
options << MUST_REVALIDATE if control[:must_revalidate]
+ options << "stale-while-revalidate=#{stale_while_revalidate.to_i}" if stale_while_revalidate
+ options << "stale-if-error=#{stale_if_error.to_i}" if stale_if_error
options.concat(extras) if extras
self._cache_control = options.join(", ")