返回顶部

收藏

Ruby 为 HTTPS 设置校验模式

更多
require 'net/https'
require 'net/http'

uri = URI.parse("<a href="https://www.yourDomain.gov/">https://www.yourDomain.gov/")

request = Net::HTTP.new(uri.host, uri.port)
request.use_ssl = true
request.ca_path = "/etc/ssl/certs/"
request.verify_mode = OpenSSL::SSL::VERIFY_PEER
response = request.get("/")
#该片段来自于http://outofmemory.cn

标签:ruby,网络

收藏

0人收藏

支持

0

反对

0