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>",:etag => etag, :updated => cached_time) do |page|<br>else<br>puts "not modified"<br>end<br><br><br><div><span class="gmail_quote">On 1/3/07, <b class="gmail_sendername">
Aaron Patterson</b> <<a href="mailto:aaron_patterson@speakeasy.net">aaron_patterson@speakeasy.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Wed, Jan 03, 2007 at 07:20:10PM -0500, William Flanagan wrote:<br>> Hi,<br>><br>> I'm using Mechanize, and I've developed a lot of code around it. I'd like<br>> to be able to check the Etag header during a get to see if the page has
<br>> changed, as well as some other http header information. Can I do that<br>> without hacking Mechanize myself?<br>><br>> Does anyone have any examples of how to do this?<br><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>)<br><br>page.header.each_header do |k,v|<br> puts "#{k} #{v}"<br>end<br><br>Hope that helps!
<br><br>--<br>Aaron Patterson<br><a href="http://tenderlovemaking.com/">http://tenderlovemaking.com/</a><br>_______________________________________________<br>Mechanize-users mailing list<br><a href="mailto:Mechanize-users@rubyforge.org">
Mechanize-users@rubyforge.org</a><br><a href="http://rubyforge.org/mailman/listinfo/mechanize-users">http://rubyforge.org/mailman/listinfo/mechanize-users</a><br></blockquote></div><br>