title: Ruby https with ca certification does not work while it worked with curl
body: <p>In ruby, I try to do a ssl connection to a nginx server I setup locally, with an auto-signed certificate. My code is :</p>
  
  <pre><code>require "net/http"
  require "net/https"
  require "openssl"
  require "uri"
  require "pp"
  
  request = Net::HTTP::Get.new("/")
  response = Net::HTTP.start(
    "localhost",
    443,
    {
      :use_ssl =&gt; true,
      :key =&gt; OpenSSL::PKey::RSA.new(File.read("/home/gg/crt/client.key")),
      :cert =&gt; OpenSSL::X509::Certificate.new(File.read("/home/gg/crt/client.crt")),
      :ca_file =&gt; "/home/gg/crt/ca.pem",
      :verify_mode =&gt; OpenSSL::SSL::VERIFY_PEER,
      :verify_depth =&gt; 5,
    }
  ) do |http|
        http.request(request)
  end
  puts response.inspect
  puts response.body
  </code></pre>
  
  <p>When I run it it return </p>
  
  <pre><code>/home/gg/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:923:in `connect': SSL_connect returned=1 errno=0 state=error: certificate verify failed (OpenSSL::SSL::SSLError)
      from /home/gg/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:923:in `block in connect'
      from /home/gg/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/timeout.rb:74:in `timeout'
      from /home/gg/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:923:in `connect'
      from /home/gg/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:863:in `do_start'
      from /home/gg/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:852:in `start'
      from /home/gg/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:583:in `start'
      from testso.rb:8:in `&lt;main&gt;'
  </code></pre>
  
  <p>But I have the correct result if I run it with curl:</p>
  
  <pre><code>curl https://localhost --key crt/client.key --cert crt/client.crt --cacert crt/ca.pem
  </code></pre>
  
  <p>What am i doing wrong?</p>