Sha256: 805a8c1eba0b694113d94c0a2d2b2ceff2853197b86b770e3dfab9b30e282479

Contents?: true

Size: 552 Bytes

Versions: 17

Compression:

Stored size: 552 Bytes

Contents

# frozen_string_literal: true
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

17 entries across 17 versions & 1 rubygems

Version Path
mechanize-2.14.0 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.13.0 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.12.2 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.12.1 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.12.0 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.11.0 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.10.1 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.10.0 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.9.2 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.9.1 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.9.0 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.8.5 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.8.4 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.8.3 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.8.2 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.8.1 lib/mechanize/test_case/modified_since_servlet.rb
mechanize-2.8.0 lib/mechanize/test_case/modified_since_servlet.rb