【问题标题】:Ruby Net::HTTPS SSL handshake errorRuby Net::HTTPS SSL 握手错误
【发布时间】:2013-02-22 11:11:32
【问题描述】:

我有以下代码

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

我完全被难住了。

【问题讨论】:

    标签: ruby openssl net-http


    【解决方案1】:

    显然 Ruby 在握手期间没有检查所有 ssl 版本。我对此了解不多,但补充说:

    https.ssl_version = :TLSv1
    

    解决了问题。

    【讨论】:

      猜你喜欢
      • 2017-02-11
      • 1970-01-01
      • 2015-02-03
      • 2016-08-08
      • 2016-04-13
      • 1970-01-01
      • 1970-01-01
      • 2016-08-22
      • 2014-01-14
      相关资源
      最近更新 更多