Debian Codegraph @

sample/ssl/ssl_client.rb

raw
1 #!/usr/bin/env ruby
2
3 $:.unshift(File.join('..', '..', 'lib'))
4 require 'httpclient'
5
6 url = ARGV.shift || 'https://localhost:8808/'
7 uri = URI.parse(url)
8
9 #ca_file = "0cert.pem"
10 #crl_file = '0crl.pem'
11
12 # create CA's cert in pem format and run 'c_rehash' in trust_certs dir. before
13 # using this.
14 ca_path = File.join(File.dirname(File.expand_path(__FILE__)), "trust_certs")
15
16 proxy = ENV['HTTP_PROXY'] || ENV['http_proxy'] || nil
17 h = HTTPClient.new(proxy)
18 #h.ssl_config.add_trust_ca(ca_file)
19 #h.ssl_config.add_crl(crl_file)
20 h.ssl_config.add_trust_ca(ca_path)
21
22 print h.get_content(url)