Start on LaTeX
Pave the way for Jason's LaTeX macro support. Also, uniformize the capitalization of "ETag".
This commit is contained in:
parent
b0e316e37c
commit
c67382d340
3 changed files with 21 additions and 8 deletions
|
@ -135,7 +135,7 @@ module ActionController
|
|||
controller.response.headers['Cache-Control'] == 'no-cache'
|
||||
controller.response.headers['Cache-Control'] = "max-age=#{controller.response.time_to_live}"
|
||||
end
|
||||
controller.response.headers['Etag'] = %{"#{MD5.new(controller.response.body).to_s}"}
|
||||
controller.response.headers['ETag'] = %{"#{MD5.new(controller.response.body).to_s}"}
|
||||
controller.response.headers['Last-Modified'] ||= Time.now.httpdate
|
||||
end
|
||||
|
||||
|
@ -148,13 +148,13 @@ module ActionController
|
|||
|
||||
def send_not_modified(controller)
|
||||
controller.logger.info "Send Not Modified"
|
||||
controller.response.headers['Etag'] = %{"#{MD5.new(fragment_body(controller)).to_s}"}
|
||||
controller.response.headers['ETag'] = %{"#{MD5.new(fragment_body(controller)).to_s}"}
|
||||
controller.render(:text => "", :status => 304)
|
||||
end
|
||||
|
||||
def client_has_latest?(cache_entry, controller)
|
||||
requestEtag = controller.request.env['HTTP_IF_NONE_MATCH'] rescue nil
|
||||
responseEtag = cache_entry.headers['Etag'] rescue nil
|
||||
responseEtag = cache_entry.headers['ETag'] rescue nil
|
||||
return true if (requestEtag and responseEtag and requestEtag == responseEtag)
|
||||
requestTime = Time.rfc2822(controller.request.env["HTTP_IF_MODIFIED_SINCE"]) rescue nil
|
||||
responseTime = Time.rfc2822(cache_entry.headers['Last-Modified']) rescue nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue