Reputation: 558
I have the following code
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 )
which generates an error: OpenSSL::SSL::SSLError: SSL_read:: ssl handshake failure
and I'm totally stumped.
Upvotes: 0
Views: 2066
Reputation: 558
Apparently Ruby wasn't checking all ssl versions durring the handshake. I don't know much about it, but adding:
https.ssl_version = :TLSv1
solved the problem.
Upvotes: 1