这个ruby代码应该连接到安全通道:
connection = Net::HTTP.new "localhost", 8081
connection.use_ssl = true
connection.ssl_version = :TLSv1_2
# ...
connection.post path, data, h
我遇到以下错误:
usr/local/rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/net/http.rb:923:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
客户端确实支持TLSv1.2,它看起来是:
ruby -ropenssl -e 'puts OpenSSL::SSL::SSLContext::METHODS' | grep 1_2
TLSv1_2
TLSv1_2_server
TLSv1_2_client
此外,服务器还支持TLSv1.2
openssl s_client -connect localhost:8081 | grep Protocol
Protocol : TLSv1.2
为什么Net :: HTTP尝试使用状态state=SSLv3
进行连接?