加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-openid:执行发现时未设置@socket

发布时间:2020-12-17 03:29:47 所属栏目:百科 来源:网络整理
导读:我与omniauth / openid有点混乱. 在尝试进行身份验证时,我在日志中发现了这一点: OpenID::FetchingError: Error fetching https://www.google.com/accounts/o8/.well-known/host-meta?hd=profiles.google.com%2Fmy_username: undefined method `io' for nil
我与omniauth / openid有点混乱.

在尝试进行身份验证时,我在日志中发现了这一点:

OpenID::FetchingError: Error fetching https://www.google.com/accounts/o8/.well-known/host-meta?hd=profiles.google.com%2Fmy_username: undefined method `io' for nil:NilClass

重要的是有nil的未定义方法io’:来自openid / fetchers.rb的NilClass,在下面的代码片段中:

module Net
class HTTP
def post_connection_check(hostname)
  check_common_name = true
  cert = @socket.io.peer_cert
  cert.extensions.each { |ext|
    next if ext.oid != "subjectAltName"
    ext.value.split(/,s+/).each{ |general_name|
      if /ADNS:(.*)/ =~ general_name
        check_common_name = false
...

该错误由@ socket.io.peer_cert生成,未定义@socket.

你们有没有遇到过这个?不太确定原因是什么.

我正在运行的版本:

> ruby?? 1.9.3dev(2010-08-17 trunk 29020)[x86_64-darwin10.4.0]
> ruby??-openid(2.1.8)
> ruby??-openid-apps-discovery(1.2.0)
> omniauth 0.2.0

解决方法

我们遇到了同样的问题,这是Net :: HTTP #connect永远不会被调用的直接结果.事实证明,我们将假网络宝石放在了引发错误的环境中(在我们的例子中是开发).

缩小fakeweb的范围允许正常处理#connect和@socket再次感到高兴.

group :test do
  gem 'fakeweb'
end

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读