I ran into a strange ‘bug’ that was a little bit more annoying to debug.
Apparently OpenSSL 1.x that is getting installed by brew doesn’t seem to be 100% compatible with Ruby, at least when you install it using RVM.
I ran into a reproducible problem when trying to connect to a salesforce sandbox account. This could be distilled down to this snipped:
1 2 3 4 5 6 7 8
Which resulted in this sad exception after 30 seconds or so:
Errno::ECONNRESET: Connection reset by peer - SSL_connect from /Users/mseeger/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:799:in `connect' from /Users/mseeger/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:799:in `block in connect' from /Users/mseeger/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/timeout.rb:54:in `timeout' from /Users/mseeger/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/timeout.rb:99:in `timeout' from /Users/mseeger/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:799:in `connect' from /Users/mseeger/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:755:in `do_start' from /Users/mseeger/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:744:in `start' from /Users/mseeger/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:1284:in `request' from /Users/mseeger/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:1307:in `send_entity' from /Users/mseeger/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:1096:in `post'
It turns out that RVM can also install openssl, and it decides to go for version 0.9.8:
$ rvm pkg install openssl Fetching openssl-0.9.8t.tar.gz to /Users/mseeger/.rvm/archives % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 3690k 100 3690k 0 0 394k 0 0:00:09 0:00:09 --:--:-- 456k Extracting openssl-0.9.8t.tar.gz to /Users/mseeger/.rvm/src Configuring openssl in /Users/mseeger/.rvm/src/openssl-0.9.8t. Compiling openssl in /Users/mseeger/.rvm/src/openssl-0.9.8t. Installing openssl to /Users/mseeger/.rvm/usr $
After that I just reinstalled Ruby and pointed it at the openssl version just to make extra sure:
rvm reinstall 1.9.3-p194 --with-openssl-dir=~/.rvm/usr
After that, the snipped ends up with a 404 as expected.