提交 d05d7e23 编写于 作者: A Aaron Patterson

remove dependency on `@cache_control` ivar

eventually we'll remove this instance variable, but this is the first
step
上级 53265e88
......@@ -131,7 +131,7 @@ def prepare_cache_control!
def handle_conditional_get!
if etag? || last_modified? || !@cache_control.empty?
set_conditional_cache_control!
set_conditional_cache_control!(@cache_control)
end
end
......@@ -141,17 +141,17 @@ def handle_conditional_get!
PRIVATE = "private".freeze
MUST_REVALIDATE = "must-revalidate".freeze
def set_conditional_cache_control!
def set_conditional_cache_control!(cache_control)
control = {}
cc_headers = cache_control_headers
if extras = cc_headers.delete(:extras)
@cache_control[:extras] ||= []
@cache_control[:extras] += extras
@cache_control[:extras].uniq!
cache_control[:extras] ||= []
cache_control[:extras] += extras
cache_control[:extras].uniq!
end
control.merge! cc_headers
control.merge! @cache_control
control.merge! cache_control
if control.empty?
set_header CACHE_CONTROL, DEFAULT_CACHE_CONTROL
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册