Skip to content

Instantly share code, notes, and snippets.

@floehopper
Created November 24, 2010 18:23
Show Gist options
  • Save floehopper/714136 to your computer and use it in GitHub Desktop.
Save floehopper/714136 to your computer and use it in GitHub Desktop.
Use httparty to connect using SSL mutual authentication
require "rubygems"
require "httparty"
class Wem
include HTTParty
debug_output $stderr
ssl_ca_file '/Users/jamesmead/Sites/ssltest/demoCA/ca.crt'
pem File.read('/Users/jamesmead/Sites/ssltest/user/hashblue.pem')
base_uri "https://127.0.0.1/"
def self.wem
response = get("/")
puts response.body
unless response.code == 200
raise "Response code: #{response.code}"
end
end
end
Wem.wem
@floehopper
Copy link
Author

Note that this requires the head version (a33741df46d1071787112eaa1d95f085175d8fb0) of httparty. This is currently not included in a released gem or even tagged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment