Sha256: 2fde49b800f346819fc72ad6ec3b9ffc4488e8a3b738c06045cb3221a17100d7

Contents?: true

Size: 522 Bytes

Versions: 15

Compression:

Stored size: 522 Bytes

Contents

class ModifiedSinceServlet < WEBrick::HTTPServlet::AbstractServlet
  def do_GET(req, res)
    s_time = 'Fri, 04 May 2001 00:00:38 GMT'

    my_time = Time.parse(s_time)

    if req['If-Modified-Since']
      your_time = Time.parse(req['If-Modified-Since'])
      if my_time > your_time
        res.body = 'This page was updated since you requested'
      else
        res.status = 304
      end
    else
      res.body = 'You did not send an If-Modified-Since header'
    end

    res['Last-Modified'] = s_time
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
mechanize-2.7.7 lib/mechanize/test_case/modified_since_servlet.rb
husc-0.2.1 vendor/bundle/gems/mechanize-2.7.6/lib/mechanize/test_case/modified_since_servlet.rb
husc-0.2.0 vendor/bundle/gems/mechanize-2.7.6/lib/mechanize/test_case/modified_since_servlet.rb
husc-0.1.1 vendor/bundle/gems/mechanize-2.7.6/lib/mechanize/test_case/modified_since_servlet.rb
husc-0.1.0 vendor/bundle/gems/mechanize-2.7.6/lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.7.6 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.7.5 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.7.4 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.7.3 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.7.2 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.7.1 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.7.0 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.6.0 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.5.1 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.5 lib/mechanize/test_case/modified_since_servlet.rb