Method: RDoc::Servlet#if_modified_since
- Defined in:
- lib/rdoc/servlet.rb
#if_modified_since(req, res, path = nil) ⇒ Object
Handles the If-Modified-Since HTTP header on req for path. If the file has not been modified a Not Modified response is returned. If the file has been modified a Last-Modified header is added to res.
267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/rdoc/servlet.rb', line 267 def if_modified_since req, res, path = nil last_modified = File.stat(path).mtime if path res['last-modified'] = last_modified.httpdate return unless ims = req['if-modified-since'] ims = Time.parse ims unless ims < last_modified then res.body = '' raise WEBrick::HTTPStatus::NotModified end end |