I'm trying to send a post request through https using net/http class in ruby and I'm getting this error:
OpenSSL::SSL::SSLError: SSL_set_tlsext_host_name
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/http.rb:920:in `connect'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/http.rb:920:in `block in connect'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/timeout.rb:76:in `timeout'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/http.rb:920:in `connect'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/http.rb:863:in `do_start'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/http.rb:852:in `start'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/http.rb:1369:in `request'
Here's the code example i'm using:
uri = URI.parse('https://somehost/1')
proxy = "proxy-chain.domain.com"
port = 911
http = Net::HTTP.new(uri.host, uri.port, proxy, port)
http.use_ssl = true
http.ssl_version = 'SSLv2'
http.ciphers = OpenSSL::Cipher.ciphers
req = Net::HTTP::Post.new(uri.request_uri)
req.set_form_data(JSON.parse(some_jsonstring_data))
res = http.request(req)
More Info:
I know that the host I'm trying to hit uses TLS1.2
I've tried to set the ssl_options as suggested in @jww's answer below with no luck... If I don't set the ssl_version I get this error:
OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A
Any help is super welcome. Thank you all!!