Bug #5110
closedRuby SSL error - sslv3 alert unexpected message
Description
I'm running ruby 1.9.2p290 on a machine with OpenSSL version 0.9.8o 01 Jun 2010
When I run the following script:
require 'net/http'
url = URI.parse('https://www.xpiron.com/schedule')
req = Net::HTTP::Get.new(url.path)
sock = Net::HTTP.new(url.host, 443)
sock.use_ssl = true
sock.start do |http|
response = http.request(req)
end
It generates an error:
/usr/local/lib/ruby/1.9.1/net/http.rb:678:in connect': SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: sslv3 alert unexpected message (OpenSSL::SSL::SSLError) from /usr/local/lib/ruby/1.9.1/net/http.rb:678:in
block in connect'
from /usr/local/lib/ruby/1.9.1/timeout.rb:44:in timeout' from /usr/local/lib/ruby/1.9.1/timeout.rb:89:in
timeout'
from /usr/local/lib/ruby/1.9.1/net/http.rb:678:in connect' from /usr/local/lib/ruby/1.9.1/net/http.rb:637:in
do_start'
from /usr/local/lib/ruby/1.9.1/net/http.rb:626:in start' from test.rb:8:in
'
If I add the following line, it works:
sock.ssl_version="SSLv3"
The HTTPS server seems to be misconfigured, but it may also be an issue with how Ruby's HTTP library negotiates SSL connections.