ruby-on-rails – Ruby on Rails Net :: HTTP use_ssl throws’u
发布时间:2020-12-16 19:43:41 所属栏目:百科 来源:网络整理
导读:这是我的代码: sock = Net::HTTP.new(url.host,url.port)sock.use_ssl = trueresponse = sock.start {|http| http.request(req)} 这里是错误: undefined method `use_ssl=' for #Net::HTTP www.paypal.com:443 open=false 谷歌让我什么都没有! 谢谢. 解决
这是我的代码:
sock = Net::HTTP.new(url.host,url.port) sock.use_ssl = true response = sock.start {|http| http.request(req)} 这里是错误: undefined method `use_ssl=' for #<Net::HTTP www.paypal.com:443 open=false> 谷歌让我什么都没有! 谢谢. 解决方法
那是因为函数是sock.use_ssl?它返回一个布尔值,它不是一个setter方法.
它似乎总是返回false.它在Net :: HTTPS包中被覆盖,如果你想要做任何SSL的东西,这可能是你应该使用的. Here is the ruby doc (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |