Created
November 1, 2011 07:13
-
-
Save poppen/1330079 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| # Usage: $0 URL CERT CERT_PASSWD | |
| require 'net/https' | |
| require 'open-uri' | |
| uri = URI.parse(ARGV[0]) | |
| pkcs12 = | |
| OpenSSL::PKCS12.new(File.read(ARGV[1]), ARGV[2] ? ARGV[2] : '') | |
| session = Net::HTTP.new(uri.host, uri.port) | |
| session.use_ssl = true | |
| session.key = pkcs12.key | |
| session.cert = pkcs12.certificate | |
| res = session.get('/') | |
| puts res.body |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment