Skip to content

Instantly share code, notes, and snippets.

@bogdan
Created June 7, 2016 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bogdan/0f427f23adf46e9c18a4340e0770ff85 to your computer and use it in GitHub Desktop.
Save bogdan/0f427f23adf46e9c18a4340e0770ff85 to your computer and use it in GitHub Desktop.
require 'open-uri'
require 'net/https'
module Net
class HTTP
alias_method :original_use_ssl=, :use_ssl=
def use_ssl=(flag)
# Ubuntu
if File.exists?('/etc/ssl/certs')
self.ca_path = '/etc/ssl/certs'
# MacPorts on OS X
# You'll need to run: sudo port install curl-ca-bundle
elsif File.exists?('/opt/local/share/curl/curl-ca-bundle.crt')
self.ca_file = '/opt/local/share/curl/curl-ca-bundle.crt'
end
self.verify_mode = OpenSSL::SSL::VERIFY_PEER
self.original_use_ssl = flag
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment