连接由peer重置 - SSL_connect

时间:2015-10-13 15:13:58

标签: ruby-on-rails ruby parse-platform https openssl

有时我从RAILS服务器发送Https请求时出现此错误,有时可以正常工作。 我想了解不工作的原因以及它有时如何工作。

我的代码:

require 'net/http'
require "uri"
require 'net/https'

def parse_query(classname, conditions)
    url = "https://link"
    uri = URI.parse(url)
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    request = Net::HTTP::Get.new(uri.request_uri)
    request["X-Parse-Application-Id"] = "some data"
    request["X-Parse-REST-API-Key"] = "some data"
    request["Content-Type"] = "application/json"

    response = http.request(request)
end

Rails版本= 4.2.1 Ruby版本= 2.2.1

0 个答案:

没有答案