简体   繁体   English

Ruby RestClient Openssl错误OS X

[英]Ruby RestClient Openssl Error OS X

I need help with resolving openssl problem. 我需要解决openssl问题的帮助。 OS X 10.11.1 OS X 10.11.1

which openssl
/usr/local/bin/openssl

openssl version
OpenSSL 1.0.2f  28 Jan 2016

rvm version
rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

gem -v
2.5.2

bundle show | grep rest
  * rest-client (1.8.0)

So, as you can see, all is up to date. 因此,如您所见,所有内容都是最新的。 But i still get error: 但是我仍然得到错误:

RestClient.get('https://www.googleapis.com')
RestClient::SSLCertificateNotVerified: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

But https on github works pretty well: 但是github上的https效果很好:

RestClient.get('https://github.com').code
 => 200 

I already read this http://railsapps.github.io/openssl-certificate-verify-failed.html 我已经阅读了此http://railsapps.github.io/openssl-certificate-verify-failed.html

Nothing helps. 没有任何帮助。 What's wrong with it? 它出什么问题了?

As pointed Eric platon google doesn't support SSL v3.0 anymore, but for mac and ruby, rvm and openssl the problem is that even you link openssl and you are using the last openssl, the ruby is compiled against the system openssl, so please try this: 正如所指出的,Eric platon google不再支持SSL v3.0,但是对于mac和ruby,rvm和openssl,问题在于,即使您链接openssl并且使用的是最后的openssl,ruby也会针对系统openssl进行编译,因此请尝试以下操作:

rvm reinstall ruby-X.Y.Z --with-openssl-dir=`brew --prefix openssl`

then it should work, 那么它应该工作,

irb(main):001:0> RestClient.get('https://www.googleapis.com')
RestClient::NotFound: 404 Not Found

and please update openssl with brew to the last version, this worked for me with the version: 并请使用brew将openssl更新到最新版本,这对我来说适用于以下版本:

╭─ ~  2.4.0@learn  SBCL 1.3.16 
╰─ brew --prefix openssl                                                                                                255 ↵  06:57 Dur  3371  16:34:01
/usr/local/opt/openssl
╭─ ~  2.4.0@learn  SBCL 1.3.16 
╰─ /usr/local/opt/openssl/bin/openssl version                                                                                           ✓  3373  17:05:45
OpenSSL 1.0.2k  26 Jan 2017

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM