Voterbox

Ruby: Get rid of "warning: peer certificate won't be verified in this SSL session"



Anyone who has written ruby cli apps that utilize SSL know that you get the following, most annoying message:

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



The work around is quite simple... just add the following the the top of one of the file you're loading:

class Net::HTTP
  alias_method :old_initialize, :initialize
  def initialize(*args)
    old_initialize(*args)
    @ssl_context = OpenSSL::SSL::SSLContext.new
    @ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
  end
end



Done.

All content generally available under the GPL unless otherwise noted.
5dollarwhitebox.org is not responsible in anyway for actions performed based on information found on this site.

Powered by Drupal - Design by Artinet