diff options
author | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-22 08:31:53 +0000 |
---|---|---|
committer | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-22 08:31:53 +0000 |
commit | 8729ba2be9165bbb5aa368af7d7a253f4babae82 (patch) | |
tree | 5936b85b869207c2e61fb7820c487181a4b04336 /test | |
parent | ed9b8604f049f9127e9b2752eea9d3c205407e19 (diff) | |
download | ruby-8729ba2be9165bbb5aa368af7d7a253f4babae82.tar.gz ruby-8729ba2be9165bbb5aa368af7d7a253f4babae82.tar.xz ruby-8729ba2be9165bbb5aa368af7d7a253f4babae82.zip |
* ext/openssl/lib/net/ssl.rb (OpenSSL::SSL::SSLContext.build): removed.
* ext/openssl/lib/net/ssl.rb (OpenSSL::SSL::SSLContext#set_params):
new method to set suitable SSL parameters.
* lib/net/pop.rb, lib/net/http.rb, lib/net/imap.rb,
test/openssl/test_ssl.rb: follow above change.
* test/net/http/test_https.rb: refine error case.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/net/http/test_https.rb | 2 | ||||
-rw-r--r-- | test/openssl/test_ssl.rb | 14 |
2 files changed, 10 insertions, 6 deletions
diff --git a/test/net/http/test_https.rb b/test/net/http/test_https.rb index d74f10712..133e95713 100644 --- a/test/net/http/test_https.rb +++ b/test/net/http/test_https.rb @@ -59,7 +59,7 @@ class TestNetHTTPS < Test::Unit::TestCase http = Net::HTTP.new("ssl.netlab.jp", 443) http.use_ssl = true assert( - http.request_head("/"){|res| }, + (http.request_head("/"){|res| } rescue false), "The system may not have default CA certificate store." ) end diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb index 1b89aa78c..2bd6689a6 100644 --- a/test/openssl/test_ssl.rb +++ b/test/openssl/test_ssl.rb @@ -245,13 +245,15 @@ class OpenSSL::TestSSL < Test::Unit::TestCase def test_verify_result start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port| sock = TCPSocket.new("127.0.0.1", port) - ctx = OpenSSL::SSL::SSLContext.build + ctx = OpenSSL::SSL::SSLContext.new + ctx.set_params ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx) assert_raise(OpenSSL::SSL::SSLError){ ssl.connect } assert_equal(OpenSSL::X509::V_ERR_SELF_SIGNED_CERT_IN_CHAIN, ssl.verify_result) sock = TCPSocket.new("127.0.0.1", port) - ctx = OpenSSL::SSL::SSLContext.build( + ctx = OpenSSL::SSL::SSLContext.new + ctx.set_params( :verify_callback => Proc.new do |preverify_ok, store_ctx| store_ctx.error = OpenSSL::X509::V_OK true @@ -262,7 +264,8 @@ class OpenSSL::TestSSL < Test::Unit::TestCase assert_equal(OpenSSL::X509::V_OK, ssl.verify_result) sock = TCPSocket.new("127.0.0.1", port) - ctx = OpenSSL::SSL::SSLContext.build( + ctx = OpenSSL::SSL::SSLContext.new + ctx.set_params( :verify_callback => Proc.new do |preverify_ok, store_ctx| store_ctx.error = OpenSSL::X509::V_ERR_APPLICATION_VERIFICATION false @@ -274,10 +277,11 @@ class OpenSSL::TestSSL < Test::Unit::TestCase } end - def test_sslctx_build + def test_sslctx_set_params start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port| sock = TCPSocket.new("127.0.0.1", port) - ctx = OpenSSL::SSL::SSLContext.build + ctx = OpenSSL::SSL::SSLContext.new + ctx.set_params assert_equal(OpenSSL::SSL::VERIFY_PEER, ctx.verify_mode) assert_equal(OpenSSL::SSL::OP_ALL, ctx.options) ciphers = ctx.ciphers |