谁读取了ENV ['SSL_CERT_FILE']的值?

时间:2021-06-21 23:02:31

I used to receive the following error:

我曾经收到以下错误:

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
from C:/Ruby1.9.2/lib/ruby/1.9.1/net/http.rb:678:in `connect' 

after reading through this, I discovered that the fix is to download the cacert.pem file from here. The post recommends doing something like this:

阅读完之后,我发现修复是从这里下载cacert.pem文件。该帖子建议做这样的事情:

ENV['SSL_CERT_FILE'] = File.join(File.dirname(__FILE__),"cacert.pem")

And, indeed, this solves the problem. However, who reads the value of SSL_CERT_FILE? Altering the environment doesn't seem like "the Ruby way" of doing it. I'm looking for a solution that could work with both Rails and Sinatra.

事实上,这解决了这个问题。但是,谁读取SSL_CERT_FILE的值?改变环境似乎不像是“Ruby方式”。我正在寻找一个可以兼容Rails和Sinatra的解决方案。

1 个解决方案

#1


9  

The openssl library uses the SSL_CERT_FILE environment variable.

openssl库使用SSL_CERT_FILE环境变量。

#1


9  

The openssl library uses the SSL_CERT_FILE environment variable.

openssl库使用SSL_CERT_FILE环境变量。