Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make ruby's xmlrpc client ignore SSL certificate errors?

Tags:

ruby

ssl

xml-rpc

When access an XML-RPC service using xmlrpc/client in ruby, it throws an OpenSSL::SSL::SSLError when the server certificate is not valid. How can I make it ignore this error and proceed with the connection?

like image 422
kdt Avatar asked Jan 20 '11 14:01

kdt


1 Answers

Turns out it's like this:

xmlrpc = ::XMLRPC::Client.new("foohost")
xmlrpc.instance_variable_get(:@http).instance_variable_set(:@verify_mode, OpenSSL::SSL::VERIFY_NONE)

That works with ruby 1.9.2, but clearly is poking at internals, so the real answer is "the API doesn't provide such a mechanism, but here's a hack".

like image 198
kdt Avatar answered Nov 05 '22 03:11

kdt