0

如何在 Asana API 文档中运行“hello”示例?

C:\Users\Desktop\ruby helloTask.rb
C:/Ruby193/lib/ruby/1.9.1/net/http.rb:799:in `connect': SSL_connect returned=1 e
rrno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL
::SSL::SSLError)
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:799:in `block in connect'
        from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
        from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:799:in `connect'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
        from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:744:in `start'
        from helloTask.rb:38:in `<main>'

我尝试运行 Asana API 文档中提到的示例,错误在上面。我哪里出错了?

4

2 回答 2

1

(我在 Asana 工作)

如果您使用的是 Ruby 1.9,则可能无法正确找到 CA 证书。如果您使用的是 Mac OS X,请尝试(重新)安装 curl-ca-bundle:

sudo port install curl-ca-bundle

http.ca_file在某些情况下您可能还需要设置。在http://martinottenwaelter.fr/2010/12/ruby19-and-the-ssl-error/上对此问题有更详尽的描述

禁用 SSL 验证当然也可以,尽管这会放弃 SSL 提供的很多安全性,因为您无法确定您是直接与 Asana 的服务器通信。

于 2012-06-20T18:51:08.307 回答
0

谷歌后我遇到了同样的问题,我不得不换行:

http.verify_mode = OpenSSL::SSL::VERIFY_PEER

http.verify_mode = OpenSSL::SSL::VERIFY_NONE

希望有帮助

于 2012-06-20T11:29:24.590 回答