我正在尝试使用Ruby的open
方法获取https页面:
response = open("https://example.com", 'User-Agent' => 'somebot').read
有时会成功,但有时我会收到此错误:
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify failed
from /usr/local/lib/ruby/2.3.0/net/http.rb:933:in `connect_nonblock'
这种情况发生的原因是什么?一些网站是如何运作的,有些网站却没有?