【问题标题】:How can I make Ruby's SOAP::RPC::Driver work with self signed certificates?如何使 Ruby 的 SOAP::RPC::Driver 与自签名证书一起使用?
【发布时间】:2008-09-24 17:50:46
【问题描述】:

当对使用自签名证书的服务器进行soap调用时,如何防止出现此异常?

require "rubygems"
gem "httpclient", "2.1.2"
require 'http-access2'
require 'soap/rpc/driver'
client = SOAP::RPC::Driver.new( url, 'http://removed' )
client.options[ 'protocol.http.ssl_config.verify_mode' ] = OpenSSL::SSL::VERIFY_NONE
client.options[ 'protocol.http.basic_auth' ] << [ url, user, pass ]

at depth 0 - 18: self signed certificate
/opt/local/lib/ruby/1.8/soap/streamHandler.rb:200:in `send_post': 415:  (SOAP::HTTPStreamError)
    from /opt/local/lib/ruby/1.8/soap/streamHandler.rb:109:in `send'
    from /opt/local/lib/ruby/1.8/soap/rpc/proxy.rb:170:in `route'
    from /opt/local/lib/ruby/1.8/soap/rpc/proxy.rb:141:in `call'
    from /opt/local/lib/ruby/1.8/soap/rpc/driver.rb:178:in `call'

【问题讨论】:

    标签: ruby soap ssl


    【解决方案1】:

    试试:

    client.options["protocol.http.ssl_config.verify_mode"] = nil 
    

    【讨论】:

    • 安全问题。危险的。但它会起作用,是的。 (ps - 不是我)
    • 这是一些非常危险的建议!
    猜你喜欢
    • 1970-01-01
    • 2011-12-23
    • 2011-04-08
    • 2021-02-19
    • 1970-01-01
    • 2010-10-06
    • 1970-01-01
    • 2021-10-23
    • 1970-01-01
    相关资源
    最近更新 更多