Created
June 7, 2016 14:05
-
-
Save bogdan/0f427f23adf46e9c18a4340e0770ff85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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