我有以下代码
uri = URI.parse( 'https://my.fancy.uri/with/some/path.ext' )
https = Net::HTTP.new( uri.host, uri.port )
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_PEER
store = OpenSSL::X509::Store.new
store.add_file( File.join( Rails.root, 'config', 'crt', 'correct_ca.crt' ) )
https.cert_store = store
request = Net::HTTP::Post.new( uri.request_uri )
request.set_form_data post_data
request.basic_auth( 'HTTP_USER', 'HTTP_PASS' )
response = https.request( request )
生成错误:OpenSSL::SSL::SSLError: SSL_read:: ssl handshake failure
我完全难过了。
答案 0 :(得分:1)
显然Ruby在握手期间没有检查所有ssl版本。我不太了解它,但补充说:
https.ssl_version = :TLSv1
解决了这个问题。