打开https时出现EOF错误
我一直在尝试使用 facebook graph api,尽管 ruby 在打开 api url 时引发 EOFError (https://graph.facebook.com/.....) 我正在使用 Ruby 1.8.6 和 Rails 2.2.2。 代码如下:
require 'uri'
require 'https'
access_token = open("https://graph.facebook.com/oauth/access_token?client_id=app_id&client_secret=app_secret&grant_type=client_credentials"){|f|
f.read
}
出现以下错误:
end of file reached
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/net/protocol.rb:133:in `sysread'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/net/protocol.rb:133:in `rbuf_fill'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/timeout.rb:62:in `timeout'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/timeout.rb:93:in `timeout'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/net/protocol.rb:126:in `readline'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/net/http.rb:2022:in `read_status_line'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/net/http.rb:2011:in `read_new'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/net/http.rb:1050:in `request'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/open-uri.rb:248:in `open_http'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/net/http.rb:543:in `start'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/open-uri.rb:242:in `open_http'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/open-uri.rb:616:in `buffer_open'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/open-uri.rb:164:in `open_loop'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/open-uri.rb:162:in `catch'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/open-uri.rb:162:in `open_loop'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/open-uri.rb:132:in `open_uri'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/open-uri.rb:518:in `open'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/open-uri.rb:30:in `open'
app/models/news_release.rb:75:in `post_to_facebook_wall'
我彻底用谷歌搜索并搜索了此错误,并尝试了 httpparty、mechanism、fb_graph 和 koala 等。 然而,这些都会引发同样的错误。 ruby-1.8.6 或 open-uri 似乎有错误,但我不想升级 ruby。
有什么想法吗? 提前致谢。
I've been trying to use facebook graph api, though ruby raise EOFError when open api url (https://graph.facebook.com/.....)
I'm using Ruby 1.8.6 and Rails 2.2.2.
The code is as follows:
require 'uri'
require 'https'
access_token = open("https://graph.facebook.com/oauth/access_token?client_id=app_id&client_secret=app_secret&grant_type=client_credentials"){|f|
f.read
}
Got following error:
end of file reached
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/net/protocol.rb:133:in `sysread'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/net/protocol.rb:133:in `rbuf_fill'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/timeout.rb:62:in `timeout'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/timeout.rb:93:in `timeout'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/net/protocol.rb:126:in `readline'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/net/http.rb:2022:in `read_status_line'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/net/http.rb:2011:in `read_new'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/net/http.rb:1050:in `request'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/open-uri.rb:248:in `open_http'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/net/http.rb:543:in `start'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/open-uri.rb:242:in `open_http'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/open-uri.rb:616:in `buffer_open'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/open-uri.rb:164:in `open_loop'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/open-uri.rb:162:in `catch'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/open-uri.rb:162:in `open_loop'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/open-uri.rb:132:in `open_uri'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/open-uri.rb:518:in `open'
/Users/user/.rvm/rubies/ruby-1.8.6-p420/lib/ruby/1.8/open-uri.rb:30:in `open'
app/models/news_release.rb:75:in `post_to_facebook_wall'
I thoroughly googled and searched about this error and tried such as httpparty, mechanism, fb_graph, and koala.
However those raise same efoerror.
It seems that there is a bug with ruby-1.8.6 or open-uri, but I don't want to upgrade ruby.
Any ideas?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来 ssl 失败,因为您没有填写参数。试试这样:
It looks like ssl is failing because you didn't fill out the parameters. Try it like this: