title: SSL_connect returned=1 errno=0 state=SSLv3 read server hello A: wrong version number (OpenSSL::SSL::SSLError)
body: <p>When I ran <code>https.ssl_version = :TLSv1_2</code> </p>
  
  <p>I got the error</p>
  
  <pre><code>ruby/2.1.0/net/http.rb:920:in `connect': 
  SSL_connect returned=1 errno=0 state=SSLv3 read server hello A: 
  wrong version number (OpenSSL::SSL::SSLError)
  </code></pre>
  
  <p>Whe I changed to <code>https.ssl_version = :SSLv3</code></p>
  
  <pre><code>ruby/2.1.0/net/http.rb:920:in `connect': 
  SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A 
  (OpenSSL::SSL::SSLError)
  </code></pre>
  
  <p>But I can do it without any error by rest client</p>
  
  <pre><code>resp = RestClient.post(server_url, content, header)
  </code></pre>
  
  <p>The ssl connection is make me confused so much.</p>
  
  <p>The problem both on macos and ubuntu 14.04</p>
  
  <h2>UPDATE</h2>
  
  <p>Check my SSL parameters</p>
  
  <h2>Under default Ruby by <code>irb</code></h2>
  
  <pre><code>irb(main):001:0&gt; require 'openssl'
  =&gt; true
  irb(main):002:0&gt;  OpenSSL::SSL::SSLContext::DEFAULT_PARAMS
  =&gt; {:ssl_version=&gt;"SSLv23", :verify_mode=&gt;1, :ciphers=&gt;"ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW", :options=&gt;-2147482625}
  </code></pre>
  
  <h2>Under Rails</h2>
  
  <pre><code>{
      :ssl_version =&gt; "SSLv23",
      :verify_mode =&gt; 1,
          :ciphers =&gt; "ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW",
          :options =&gt; -2147482625
  }
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  </code></pre>
  
  <h2>Brute force to try all kind of SSL version within Rails</h2>
  
  <pre><code>I changed the method by `OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:ssl_version]=method`
  
  :TLSv1
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :TLSv1_server
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :TLSv1_client
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :TLSv1_2
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :TLSv1_2_server
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :TLSv1_2_client
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :TLSv1_1
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :TLSv1_1_server
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :TLSv1_1_client
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :SSLv3
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :SSLv3_server
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :SSLv3_client
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :SSLv23
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :SSLv23_server
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :SSLv23_client
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :TLSv1
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :TLSv1_server
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :TLSv1_client
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :TLSv1_2
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :TLSv1_2_server
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :TLSv1_2_client
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :TLSv1_1
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :TLSv1_1_server
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :TLSv1_1_client
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :SSLv3
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :SSLv3_server
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :SSLv3_client
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :SSLv23
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :SSLv23_server
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  :SSLv23_client
  #&lt;OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A&gt;
  </code></pre>