繁体   English   中英

Ruby RestClient Openssl错误OS X

[英]Ruby RestClient Openssl Error OS X

我需要解决openssl问题的帮助。 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)

因此,如您所见,所有内容都是最新的。 但是我仍然得到错误:

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

但是github上的https效果很好:

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

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

没有任何帮助。 它出什么问题了?

正如所指出的,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`

那么它应该工作,

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

并请使用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