File: ssl_client.rb

package info (click to toggle)
libhttp-access2-ruby 2.1.5.2-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 760 kB
  • ctags: 628
  • sloc: ruby: 6,010; makefile: 5
file content (22 lines) | stat: -rw-r--r-- 579 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env ruby

$:.unshift(File.join('..', '..', 'lib'))
require 'httpclient'

url = ARGV.shift || 'https://localhost:8808/'
uri = URI.parse(url)

#ca_file = "0cert.pem"
#crl_file = '0crl.pem'

# create CA's cert in pem format and run 'c_rehash' in trust_certs dir. before
# using this.
ca_path = File.join(File.dirname(File.expand_path(__FILE__)), "trust_certs")

proxy = ENV['HTTP_PROXY'] || ENV['http_proxy'] || nil
h = HTTPClient.new(proxy)
#h.ssl_config.set_trust_ca(ca_file)
#h.ssl_config.set_crl(crl_file)
h.ssl_config.set_trust_ca(ca_path)

print h.get_content(url)