RestClient::SSLCertificateNotVerified:SSL_connect 返回=1 errno=0 state=SSLv3 读取服务器证书 B:证书验证失败 [英] RestClient::SSLCertificateNotVerified: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

查看:54
本文介绍了RestClient::SSLCertificateNotVerified:SSL_connect 返回=1 errno=0 state=SSLv3 读取服务器证书 B:证书验证失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将 verify_ssl=>false 放入请求中,但它不起作用.

I tried to put verify_ssl=>false to the request, but it doesn't work.

下面是我的代码:

def login_request (username, password)
  request_body_map = {:userName => username, :password => password}
  request_header = {:content_type => 'application/json', :accept => 'application/json'} 
  begin
    res = RestClient.post endpoint, request_body_map.to_json, {:header => request_header, :verify_ssl => false} 
    response_data = JSON.parse(res.body) 
  rescue Exception => e raise e
  end
end

推荐答案

请使用 RestClient::Request.execute(method: :get, url: url, headers: headers, verify_ssl: false)

verify_ssl 在 RestCient.method 中不被接受

verify_ssl is not accepted in RestCient.method

这篇关于RestClient::SSLCertificateNotVerified:SSL_connect 返回=1 errno=0 state=SSLv3 读取服务器证书 B:证书验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆