Ruby XMLRPC over a Self Certified SSL with a warning

If you use the XMLRPC client in ruby over a self certified SSL you have this warning :

warning: peer certificate won’t be verified in this SSL session

You can get override that warning cleanly (i have seen some people who just comment the message in the standard library) like that :

require 'xmlrpc/client'

require 'net/https'
require 'openssl'
require 'pp'

module SELF_SSL
  class Net_HTTP < Net::HTTP
    def initialize(*args)
      @ssl_context =
      @ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE

  class XMLRPC_Client < XMLRPC::Client
    def initialize(*args)
      @http = @host, @port,
                                      @proxy_host,@proxy_port )
      @http.use_ssl = @use_ssl if @use_ssl
      @http.read_timeout = @timeout
      @http.open_timeout = @timeout



if __FILE__ == $0
  f = SELF_SSL::XMLRPC_Client.new2("https://url")
  puts"method", 'arg')

2 thoughts on “Ruby XMLRPC over a Self Certified SSL with a warning”

  1. Also you can do like this:

    server = XMLRPC::Client.new2(‘https://…….

    server.instance_variable_get(:@http).instance_variable_set(:@verify_mode, OpenSSL::SSL::VERIFY_NONE)…….

  2. Hello,

    The above code written by “rarara” is wrong. The correct code is:

    server.instance_variable_get(:@http).instance_variable_get(:@ssl_context).instance_variable_set(:@verify_mode, OpenSSL::SSL::VERIFY_NONE)

Leave a Reply to Michael Conigliaro Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.