ubuntu server 12.04, 11.10, mechanize 2.5.1 SSL problem

when submit login info with SSL connection, (楽天ログインページ)

a.get('http://www.rakuten.co.jp/myrakuten/login.html')
a.page.form_with(:name => 'login'){|f| f.set_fields('u' => userid, 'p' => passwd)}.click_button
HTML:

I got SSL_connect Error:

~/.rvm/gems/ruby-1.9.3-p194/gems/net-http-persistent-2.7/lib/net/http/persistent/ssl_reuse.rb:70:in `connect': Connection reset by peer - SSL_connect (Errno::ECONNRESET)

but error is depends on the site that mechanize is trying submitting, for example Yahoo login page does't have this problem. (Yahooのログインページもhttpsにも関わらずこの問題が出ない。)

I guessed it might be SSL certificate problem, so i did:

rvm pkg install openssl
rvm install 1.9.3 --with-openssl-dir=$rvm_path/usr
export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt

then it worked!

to make it permanent,add export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt to
/etc/profile