Cannot establish https connection with ruby

I tried more than 5 different versions of ruby, currently using 1.9.2-p194. I get this error:

Connection reset by peer - SSL_connect (Errno::ECONNRESET) 

I recompiled, I tried rvm, rbenv and even apt-get ruby ​​... this works:

 openssl ssl_client -connect google.com:443 

But this is not so:

 require "net/https" require "uri" uri = URI.parse("https://google.com/") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE http.start do |agent| p agent.get(uri.path).read_body end 

Does anyone have any ideas how I can better debug this? I am using Ubuntu 12.04. Locally, where it works, I use Ubuntu 10.10. However, openssl ssl_client works on both OSs, so I can only assume that this is a problem with ruby.

EDIT:

I got it to work using rbenv 1.9.2-p320, but the same ruby ​​version did not work with rvm. I would appreciate understanding.

+4
source share
2 answers

Suppose you need to reinstall (recompile) Ruby after installing OpenSSL using

 rvm reinstall 1.9.3 
+2
source

For those who have the same problems. I found my problem because I had ssl: true in config / ldap.yml (if you have this, make sure your ldap server is ssl). If this helps you choose this as an answer for those who come next.

+1
source

Source: https://habr.com/ru/post/1432320/


All Articles