Ruby SSL error - sslv3 alert unexpected message

前端 未结 5 2117
青春惊慌失措
青春惊慌失措 2020-12-10 18:05

I\'m trying to connect to the server https://www.xpiron.com/schedule in a ruby script. However, when I try connecting:

require \'open-uri\'
doc          


        
5条回答
  •  独厮守ぢ
    2020-12-10 18:51

    Just to answer my own question.

    The problem seems to be with how Ruby negotiates SSL connections. There's an error in Xpiron's TLS mechanism, and it throws an error instead of retrying to other SSL versions.

    If you force the SSL version to 3.0, it works:

    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.ssl_version="SSLv3"
    sock.start do |http|
        response = http.request(req)
    end
    

    I also created an issue on Ruby's bug tracker.

提交回复
热议问题