WWW::MechanizeでリダイレクトされるURLを開くと複数回戻る必要があるっぽい

http://www.ruby-lang.org/http://www.ruby-lang.org/en/ にリダイレクトされる。

$ wget --spider http://www.ruby-lang.org/
--19:12:06--  http://www.ruby-lang.org/
           => `index.html'
Resolving www.ruby-lang.org... 221.186.184.68
Connecting to www.ruby-lang.org|221.186.184.68|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://www.ruby-lang.org/en/ [following]
--19:12:07--  http://www.ruby-lang.org/en/
           => `index.html'
Connecting to www.ruby-lang.org|221.186.184.68|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
200 OK

そして、そのようなページをRubyのWWW::Mechanizeに開かせると、戻るを2回やる必要がある。なんだこりゃぁ、バグかよ!?ふつうのブラウザだったら1回戻ればいいのに…

require 'rubygems'
require 'mechanize'
agent = WWW::Mechanize.new
agent.get "http://www.yahoo.co.jp"
agent.get "http://www.ruby-lang.org/ja/"
agent.page.uri  # => #<URI::HTTP:0xb75dce30 URL:http://www.ruby-lang.org/ja/>
# 戻るは正しく動作する
agent.back
agent.page.uri  # => #<URI::HTTP:0xb75e04a4 URL:http://www.yahoo.co.jp/>
# しかし、リダイレクトがからむと、
agent.get "http://www.ruby-lang.org/"
agent.page.uri  # => #<URI::HTTP:0xb75d62ec URL:http://www.ruby-lang.org/en/>
# 2回戻る必要がある。
agent.back
agent.page.uri  # => #<URI::HTTP:0xb75d62ec URL:http://www.ruby-lang.org/en/>
agent.back
agent.page.uri  # => #<URI::HTTP:0xb75e04a4 URL:http://www.yahoo.co.jp/>

もうすこし調べてみてバグっぽいならバグレポ送るか。