<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&#8217;s a good question. &nbsp;I wanted to read the tag, so that I could do the analysis myself. &nbsp;To conserve bandwidth, you&#8217;d have to put the tag and post it in the initial get. &nbsp;I don&#8217;t know how to do this. &nbsp;Does anyone have sample code to do this, for the sake of the &#8220;Internet&#8217;s&#8221; completeness?<BR>
<BR>
William<BR>
<BR>
<BR>
On 1/4/07 12:22 PM, &quot;Dominic Sisneros&quot; &lt;dsisnero@gmail.com&gt; 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">&lt;http://www/some_huge_file_infrequently_changed&gt;</a> &quot;,:etag =&gt; etag, :updated =&gt; cached_time) do |page|<BR>
else<BR>
puts &quot;not modified&quot;<BR>
end<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Lucida Grande, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'><BR>
Sure. &nbsp;You can access the response from the page object. &nbsp;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/&#39;">&lt;http://www.google.com/&amp;#39;&gt;</a> )<BR>
<BR>
page.header.each_header do |k,v|<BR>
&nbsp;&nbsp;puts &quot;#{k} #{v}&quot;<BR>
end<BR>
<BR>
</SPAN></FONT></BLOCKQUOTE></BLOCKQUOTE>
</BODY>
</HTML>