From: Shea Martin Date: 2007-08-03T03:35:03+09:00 Subject: Re: net::http and caching files I have just tried about 20 servers (random urls), and have not seen and etag or last_modified on any of them. Is there really that few of servers which support the two? Am I doing something wrong? I am on win32 if it matters. CODE: require 'open-uri' # h = {} # h['If-Modified-Since'] = 'Thu, 09 Aug 2007 17:33:40 GMT' http = Net::HTTP.new( "www.google.com" ) resp, data = http.get( "/index.html" ) p "r is #{resp}" p "code is #{resp.code}" resp.each { |k,v| p "#{k} = #{v}" } #open( "http://google.ca" ) do |f| # p f.last_modified #end exit 0 ~S Lionel Bouton wrote: > >> >> Just read what 'etag' is. Do I actually need mtime, if I have etag? > > Depends on the server on the other side. Both have roughly the same > usage ('last_modified' can't be reliably parsed as an accurate date as > there are servers with inaccurate clocks or bad timezone settings) but > anyone of them can be used at the server's discretion. If you don't know > in advance which server you'll fetch information from and which header > it will respond with, better implement support bor both. > > Lionel >