5dollarwhitebox.org - theboxownsyou

  • blog
  • projects
  • articles
  • tech wiki
  • about
  • login
Home › Ruby Reference

RSS Feed

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

drks — Tue, 2008-10-14 14:03



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.

‹ Ruby Dual Output / Logging up
  • Printer-friendly version



Who's online

There are currently 0 users and 1 guest online.
  • blog
  • projects
  • articles
  • tech wiki
  • about
  • login

5dollarwhitebox.org is not responsible in anyway for actions performed based on information found on this site.