如何让 HTTParty 忽略 SSL? [英] How do I make HTTParty ignore SSL?

查看:105
本文介绍了如何让 HTTParty 忽略 SSL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用本地服务器来测试应用程序,并从我自己的机器向该服务器发出请求.

I'm using a local server to test an application, and make requests to that server from my own machine.

测试服务器的 SSL 不好,因此 HTTParty 会抛出错误.从我读到的,HTTParty 应该默认忽略 SSL,但是当我尝试这样做时:

The test server's SSL is bad, and HTTParty throws errors because of that. From what I read, HTTParty should ignore SSL by default, but when I try to do this:

HTTParty.get( "#{ @settings.api_server }#{ url }" ).parsed_response

它抛出这个错误:

OpenSSL::SSL::SSLError at /
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

如何让它忽略 SSL?

How do I make it ignore the SSL?

推荐答案

在最新的HTTParty中,可以使用verify选项禁用SSL验证;

In the latest HTTParty, you can use the verify option to disable SSL verification;

HTTParty.get( "#{ @settings.api_server }#{ url }", :verify => false ).parsed_response

这篇关于如何让 HTTParty 忽略 SSL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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