Skip to content

Instantly share code, notes, and snippets.

@siruguri
Created April 14, 2015 18:49
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save siruguri/66926b42a0c70ef7119e to your computer and use it in GitHub Desktop.
Save siruguri/66926b42a0c70ef7119e to your computer and use it in GitHub Desktop.
Removing and setting constants in Ruby
# I am doing this because the server admin forgot to
# Renew their certificate!
prev_setting = OpenSSL::SSL.send(:remove_const, :VERIFY_PEER)
OpenSSL::SSL.const_set(:VERIFY_PEER, OpenSSL::SSL::VERIFY_NONE)
# do my connnection thang!
OpenSSL::SSL.send(:remove_const, :VERIFY_PEER)
OpenSSL::SSL.const_set(:VERIFY_PEER, prev_setting)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment