module Roda::RodaPlugins::Caching::RequestMethods
def last_modified(time)
before than the time specified, immediately returns a response
If the current request includes an If-Unmodified-Since header that is
with a 304 status.
equal or later than the time specified, immediately returns a response
If the current request includes an If-Modified-Since header that is
The +time+ argument should be a Time instance.
Set the last modified time of the resource using the Last-Modified header.
def last_modified(time) return unless time res = response e = env res[RodaResponseHeaders::LAST_MODIFIED] = time.httpdate return if e['HTTP_IF_NONE_MATCH'] status = res.status if (!status || status == 200) && (ims = time_from_header(e['HTTP_IF_MODIFIED_SINCE'])) && ims >= time.to_i res.status = 304 halt end if (!status || (status >= 200 && status < 300) || status == 412) && (ius = time_from_header(e['HTTP_IF_UNMODIFIED_SINCE'])) && ius < time.to_i res.status = 412 halt end end