rest-client gem无法使用Cloudflare SSL证书

时间:2015-06-21 14:38:39

标签: ruby openssl osx-yosemite rest-client

rest-client gem无法使用Clourflare Shared SSL,我收到以下错误:

irb(main):001:0> require 'rest-client'
=> true
irb(main):002:0> RestClient.get('https://bkam.com')
RestClient::SSLCertificateNotVerified: SSL_connect returned=1 errno=0 state=error: certificate verify failed:
    from /usr/local/lib/ruby/gems/2.2.0/gems/rest-client-1.8.0/lib/restclient/request.rb:445:in `rescue in transmit'
    from /usr/local/lib/ruby/gems/2.2.0/gems/rest-client-1.8.0/lib/restclient/request.rb:350:in `transmit'
    from /usr/local/lib/ruby/gems/2.2.0/gems/rest-client-1.8.0/lib/restclient/request.rb:176:in `execute'
    from /usr/local/lib/ruby/gems/2.2.0/gems/rest-client-1.8.0/lib/restclient/request.rb:41:in `execute'
    from /usr/local/lib/ruby/gems/2.2.0/gems/rest-client-1.8.0/lib/restclient.rb:65:in `get'
    from (irb):3
    from /usr/local/bin/irb:11:in `<main>'

以下是我用cURL尝试相同的网址时

#curl -I https://bkam.com
HTTP/1.1 301 Moved Permanently
Server: cloudflare-nginx
Date: Sun, 21 Jun 2015 14:37:25 GMT
Content-Type: text/html
Connection: keep-alive
Set-Cookie: __cfduid=d186172655f741ece4bb040858a27a4a51434897445; expires=Mon, 20-Jun-16 14:37:25 GMT; path=/; domain=.bkam.com; HttpOnly
Cf-Railgun: direct (starting new WAN connection)
Location: https://eg.bkam.com/
Strict-Transport-Security: max-age=0
X-Content-Type-Options: nosniff
CF-RAY: 1fa0738914022324-FRA

但是,当我尝试使用与Google.com或CloudFlare.com相同的方法时,它运行正常!

我在OS X Yosemite(10.10.3)上运行OpenSSL 1.0.2c 2015年6月12日,ruby 2.2.2p95和rest-client 1.8.0

0 个答案:

没有答案