jruby-openssl vs mri openssl - Socket Closed

时间:2012-11-10 05:54:22

标签: ruby-on-rails ruby openssl jruby jruby-openssl

问题:当使用带有OpenSSL :: SSLError Socket Closed的jruby时,Net :: HTTP调用失败,但使用MRI工作正常。

备注:对许多服务器的呼叫都有效,但此应用正在呼叫cisco传感器。同样,它通过MRI而不是Jruby工作。我尝试过很多不同的东西都无济于事。我试过jruby 1.6.7,1.7和最近发布的1.7.1.dev。我也试过jruby-openssl-0.7.4,0.7.7和0.8.0.pre3。我甚至尝试使用Ruby 1.8和1.9运行脚本。

https://github.com/jruby/jruby/blob/master/src/org/jruby/ext/openssl/SSLSocket.java#L404失败?

研究中的类似问题:http://jira.codehaus.org/browse/JRUBY-6346

Small Back Trace Excerpt

org/jruby/ext/openssl/Utils.java:79:in newError'
org/jruby/ext/openssl/SSL.java:92:innewSSLError'
org/jruby/ext/openssl/SSLSocket.java:192:in connectCommon'
org/jruby/ext/openssl/SSLSocket.java:162:inconnect'
org/jruby/runtime/callsite/CachingCallSite.java:306:in cacheAndCall'
org/jruby/runtime/callsite/CachingCallSite.java:136:incall'
org/jruby/ast/CallNoArgNode.java:64:in interpret'
org/jruby/ast/NewlineNode.java:105:ininterpret'

我没有运气地搜索谷歌。任何帮助将不胜感激。

还应该注意到我正在运行OSX Mountain Lion 10.8.2。

[UPDATE]

我已经没时间调试了这个并使用了以下解决方法: 的Gemfile

gem 'typhoeus'

测试方法

def send_post(url, body)
  response  = Typhoeus::Request.post(url,
    :method => :post,
    :disable_ssl_host_verification => true,
    :disable_ssl_peer_verification => true,
    :username => @auth[:username],
    :password => @auth[:password],
    :headers => {
      'Accept' => 'text/xml',
      'Content-type' => 'application/binary',
      'Connection' => 'keepalive',
      'Accept-Charset' => 'iso-8859-1,*,utf-8',
      'Pragma' => 'no-cache',
      'Cache-Control' => 'no-cache',
    },
    :body => body
  )
  response
end

0 个答案:

没有答案