title: How to get redirect log in Mechanize?
body: <p>In ruby, if you use mechanize following 301/302 redirects like this</p>
  
  <pre><code>require 'mechanize'
  
  m = WWW::Mechanize.new
  m.get('http://google.com')
  </code></pre>
  
  <p>how to get the list of the pages mechanize was redirected through? (Like <a href="http://google.com" rel="nofollow noreferrer">http://google.com</a> => <a href="http://www.google.com" rel="nofollow noreferrer">http://www.google.com</a> => <a href="http://google.com.ua" rel="nofollow noreferrer">http://google.com.ua</a>)</p>
  
  <p>OK, here is the code in mechanize responsible for redirection</p>
  
  <pre><code> elsif res_klass &lt;= Net::HTTPRedirection
          return page unless follow_redirect?
          log.info("follow redirect to: #{ response['Location'] }") if log
          from_uri  = page.uri
          raise RedirectLimitReachedError.new(page, redirects) if redirects + 1 &gt; redirection_limit
          redirect_verb = options[:verb] == :head ? :head : :get
          page = fetch_page(  :uri =&gt; response['Location'].to_s,
                              :referer =&gt; page,
                              :params  =&gt; [],
                              :verb =&gt; redirect_verb,
                              :redirects =&gt; redirects + 1
                           )
          @history.push(page, from_uri)
          return page
  </code></pre>
  
  <p>but trying to m.history.map {|p| puts p.uri} shows 3 times the uri of last page..</p>