Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
RubyでのHTTPS接続のサンプル
require 'net/http'
require 'openssl'
host = 'www.google.com'
https = Net::HTTP.new(host, 443)
#https.open_timeout = SYSTEM_TIMEOUT_SEC
#https.read_timeout = SYSTEM_TIMEOUT_SEC
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_PEER
https.verify_depth = 5
#https.ca_file = '/path/to/cacert.pem'
https.start do |h|
res = h.get('/')
p res
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment