EOFError:在生产服务器环境中使用Net :: HTTP Post到达文件的末尾

时间:2017-07-05 10:28:32

标签: ruby-on-rails http ssl https

这是我在我的localhost中发布值的代码,它在server:

中运行
uri = URI.parse('http://localhost:4000/')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == "https"
headers = 'email='+email
resp = http.post(uri.path,headers)
json_obj = JSON.parse(resp.body)
if(json_obj['prediction'] == 'important')
  return true
else
  return false
end

代码在我的本地计算机上完美运行但在服务器生产中无效,有些人建议我添加http.use_ssl = true if uri.scheme == "https",但这仍然给我错误EOFError: end of file reached,如何解决此错误?任何有这个错误的解决方案的人都将不胜感激。

0 个答案:

没有答案