Rails 4和Ruby 2 Net/HTTP SSL请求:OpenSSL :: SSL :: SSLError:SSL_connect返回= 1 errno = 0状态= SSLv2/v3读取服务器问候A:未知协议 [英] Rails 4 and Ruby 2 Net/HTTP SSL Request: OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol

查看:110
本文介绍了Rails 4和Ruby 2 Net/HTTP SSL请求:OpenSSL :: SSL :: SSLError:SSL_connect返回= 1 errno = 0状态= SSLv2/v3读取服务器问候A:未知协议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这几乎是以下内容的副本:

This is nearly a duplicate of:

SSL_connect返回= 1 errno = 0 state = SSLv3读取服务器证书B:证书验证失败

但是特定于Rails 4和Ruby 2环境.我认为提出一个新问题是适当的,因为在我的机器上适用于以前环境的解决方案在更新后似乎不再起作用到Rails和Ruby.

but specific to a Rails 4 and Ruby 2 environment. I figure it is appropriate to make a new question because the solutions that worked on my machine for previous environments no longer appear to work after the updates to Rails and Ruby.

在发出符合以下要求的Net/HTTP SSL请求时:

When making a Net/HTTP SSL request to the tune of:

api_uri = URI("http://accounts.google.com/o/oauth2/token")
https = Net::HTTP.new(api_uri.host, api_uri.port)
https.use_ssl = true
https.ca_file = '/usr/local/etc/openssl/cert.pem' if Rails.env == "development"
https.request_get(api_uri.path)

我收到了

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol

错误.我已经尝试了在以前的环境中无法解决的引用问题中的解决方案.

error. I've tried out the solutions in the referenced question that worked in the previous environments, to no avail.

推荐答案

看起来像是一个错字-它应该是第一行中URI中的https://协议(而不是http://)

Looks like it a typo - it should be an https:// protocol in the URI on the first line (and not http://)

这篇关于Rails 4和Ruby 2 Net/HTTP SSL请求:OpenSSL :: SSL :: SSLError:SSL_connect返回= 1 errno = 0状态= SSLv2/v3读取服务器问候A:未知协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆