-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ssl: add ssl_cert option to support pkcs12 self-signed cert #165
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Patron | ||
VERSION = "0.12.1" | ||
VERSION = "0.13.0" | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
require 'fileutils' | ||
|
||
describe Patron::Session do | ||
|
||
before(:each) do | ||
@session = Patron::Session.new | ||
@session.base_url = "https://localhost:9043" | ||
|
@@ -34,7 +33,7 @@ | |
tmpfile = "/tmp/patron_test.yaml" | ||
@session.get_file "/test2", tmpfile | ||
File.unlink(tmpfile) | ||
|
||
# and this one segfaults | ||
pid = fork do | ||
tmpfile = "/tmp/patron_test.yaml" | ||
|
@@ -44,11 +43,11 @@ | |
expect(body.request_method).to be == "GET" | ||
FileUtils.rm tmpfile | ||
end | ||
|
||
exit_pid, status = Process.wait2(pid) | ||
expect(status.exitstatus).to be_zero | ||
end | ||
|
||
it "should download correctly(md5 ok) with get_file" do | ||
tmpfile = "/tmp/picture" | ||
response = @session.get_file "/picture", tmpfile | ||
|
@@ -258,6 +257,16 @@ | |
expect(body.request_method).to be == "GET" | ||
end | ||
|
||
it "should work when ssl_cert is supplied" do | ||
@session.insecure = nil | ||
@session.ssl_cert = 'spec/certs/keystore.p12' | ||
@sessions.ssl_cert_type = "p12" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, my bad |
||
@session.ssl_key_password = "pkcs12" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the password is set incorrectly, what is the exception that is going to be raised? Do we need a separate exception type for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, will add a spec for that case There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
trying to connect with wrong password, seems like failed at SSL level There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, would be useful to check for a proper exception in that case on the Patron end There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, it's kind of busy in those days, i will catch and update this PR asap |
||
response = @session.get("/test") | ||
body = YAML::load(response.body) | ||
expect(body.request_method).to be == "GET" | ||
end | ||
|
||
it "should work with different SSL versions" do | ||
['SSLv3','TLSv1'].each do |version| | ||
@session.ssl_version = version | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://curl.haxx.se/mail/lib-2005-03/0172.html
found CURLOPT_SSLKEYPASSWD in maillist