<HTML>
<HEAD>
<TITLE>Re: [Mechanize-users] Help accessing http headers?</TITLE>
</HEAD>
<BODY>
<FONT FACE="Lucida Grande, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'>That’s a good question. I wanted to read the tag, so that I could do the analysis myself. To conserve bandwidth, you’d have to put the tag and post it in the initial get. I don’t know how to do this. Does anyone have sample code to do this, for the sake of the “Internet’s” completeness?<BR>
<BR>
William<BR>
<BR>
<BR>
On 1/4/07 12:22 PM, "Dominic Sisneros" <dsisnero@gmail.com> wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Lucida Grande, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'>Is there any way to have a get option that uses the etag or not-modified header to not got a file if it hasn't changed.<BR>
<BR>
This will cut down on bandwidth usage<BR>
<BR>
if WWW::Mechanize.new().get(' <a href="http://www/some_huge_file_infrequently_changed">http://www/some_huge_file_infrequently_changed</a> <a href="http://www/some_huge_file_infrequently_changed"><http://www/some_huge_file_infrequently_changed></a> ",:etag => etag, :updated => cached_time) do |page|<BR>
else<BR>
puts "not modified"<BR>
end<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Lucida Grande, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'><BR>
Sure. You can access the response from the page object. Here's an <BR>
example:<BR>
<BR>
page = WWW::Mechanize.new().get('<a href="http://www.google.com/'">http://www.google.com/'</a> <a href="http://www.google.com/'"><http://www.google.com/&#39;></a> )<BR>
<BR>
page.header.each_header do |k,v|<BR>
puts "#{k} #{v}"<BR>
end<BR>
<BR>
</SPAN></FONT></BLOCKQUOTE></BLOCKQUOTE>
</BODY>
</HTML>