HTTPS 和 HTTParty - 超时和 EOF
我正在尝试将某些内容发布到 HTTPS 资源,但似乎不起作用。
我的代码如下所示:
require 'httparty'
class MyClass
include HTTParty
base_uri "https://mydomain.com:8085/search"
basic_auth 'admin', 'changeme'
format :xml
def mymethod
self.class.post('/job', :query => {:search => "*"})
end
end
如您所见,我定义了一个包含“https”的 URI,因此它应该自动为 Net::HTTPS 库设置 use_ssl 属性。 由于某种原因,请求了 Net::HTTP,但我从未与服务器取得联系,所以我最终得到了 EOF。
有什么线索吗?
I'm trying to post something to an HTTPS resource, but it seems it doesn't work.
My code look something like this:
require 'httparty'
class MyClass
include HTTParty
base_uri "https://mydomain.com:8085/search"
basic_auth 'admin', 'changeme'
format :xml
def mymethod
self.class.post('/job', :query => {:search => "*"})
end
end
As you can see, I've defined an URI with 'https' included, so it should set the use_ssl property for the Net::HTTPS library automatically.
For some reason, Net::HTTP is requested, and I never get in touch with the server, so I end up with an EOF.
Any clues?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如读到的
http:// railstips.org/blog/archives/2008/07/29/it-s-an-httparty-and-everyone-is-invited/
“HTTPS 已启用。如果 uri 有端口 443,它会自动打开 https ”。
As read at
http://railstips.org/blog/archives/2008/07/29/it-s-an-httparty-and-everyone-is-invited/
"HTTPS is in. If the uri has port 443 it automatically turns https on."