diff options
author | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-24 07:31:23 +0000 |
---|---|---|
committer | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-24 07:31:23 +0000 |
commit | a3bfedac36e946790c966c0319765479df770e4b (patch) | |
tree | 65a7e313612bef6245f1f0052308aace47e0da84 /sample/openssl/wget.rb | |
parent | 8fd40444465a6165f08490269f8e0b142edc2824 (diff) | |
download | ruby-a3bfedac36e946790c966c0319765479df770e4b.tar.gz |
* sample/openssl: reviewed and remove dependency on getopts.rb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/openssl/wget.rb')
-rw-r--r-- | sample/openssl/wget.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sample/openssl/wget.rb b/sample/openssl/wget.rb index 0362ab980d..ee637204db 100644 --- a/sample/openssl/wget.rb +++ b/sample/openssl/wget.rb @@ -1,11 +1,11 @@ #!/usr/bin/env ruby require 'net/https' -require 'getopts' +require 'optparse' -getopts nil, 'C:' +options = ARGV.getopts('C:') -ca_path = $OPT_C +cert_store = options["C"] uri = URI.parse(ARGV[0]) if proxy = ENV['HTTP_PROXY'] @@ -18,11 +18,12 @@ h = Net::HTTP.new(uri.host, uri.port, prx_host, prx_port) h.set_debug_output($stderr) if $DEBUG if uri.scheme == "https" h.use_ssl = true - if ca_path - h.verify_mode = OpenSSL::SSL::VERIFY_PEER - h.ca_path = ca_path - else - $stderr.puts "!!! WARNING: PEER CERTIFICATE WON'T BE VERIFIED !!!" + if cert_store + if File.directory?(cert_store) + h.ca_path = cert_store + else + h.ca_file = cert_store + end end end |