通过 ssl 进行路边柱
如何使用遏制红宝石宝石通过 https 发布帖子?
这就是我通过 http 将文件发布到服务器的方法:
c = Curl::Easy.new("http://www.myserver.com/upload_messages")
c.multipart_form_post = true
post_field = Curl::PostField.content('fieldname', myfile)
c.http_post(post_field)
使用 net::http 我会使用 use_ssl = true 但如何使用遏制来做到这一点?
这篇文章转到了在heroku上运行的应用程序,我现在得到的错误是:
Curl::Err::SSLCaertBadFile (Curl::Err::SSLCaertBadFile)
谢谢。
how can you do a post over https using curb ruby gem?
This is how I do it over http to post a file to a server:
c = Curl::Easy.new("http://www.myserver.com/upload_messages")
c.multipart_form_post = true
post_field = Curl::PostField.content('fieldname', myfile)
c.http_post(post_field)
With net::http I would use use_ssl = true but how to do it with curb?
The post goes to an application running on heroku and the error I get now is:
Curl::Err::SSLCaertBadFile (Curl::Err::SSLCaertBadFile)
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过
c = Curl::Easy.new("https://www.myserver.com/upload_messages")
(请注意网址上的 https 而不是 http),因为在此示例中( https://github.com/taf2/curb/blob/master/samples/gmail.rb)来自 Curb 的 Github(我认为可行,我自己还没有尝试过),他们发布通过 https 发送到 Gmail 就可以了。Have you tried
c = Curl::Easy.new("https://www.myserver.com/upload_messages")
(note the https instead of http on the url), cause in this example (https://github.com/taf2/curb/blob/master/samples/gmail.rb) from Curb's Github (that I suppose works, haven't tried it myself) they post to Gmail through https just doing that.看来您的证书有问题,应该有信任未签名的选项。
还可以尝试 curb-fu gem。在那里你可以像这样发出 ssl post 请求
It seems that you have bad certificates and there should be option to trust unsigned.
Also try curb-fu gem. There you can make ssl post request like