aboutsummaryrefslogtreecommitdiffstats
path: root/test/openssl
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-01 00:12:46 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-01 00:12:46 +0000
commitd8225d9f048e0df232cde5f17941b8e06d621d0b (patch)
tree64e86fc95675cf4a9ca5c9bdf09c67b047ab2486 /test/openssl
parentbcc2641ed853d69b7717b9ef1a2c5e13f3d56e43 (diff)
downloadruby-d8225d9f048e0df232cde5f17941b8e06d621d0b.tar.gz
* ext/openssl/ossl_ssl.c (ossl_sslctx_setup): Implement
SSLContext#options and options= using SSL_CTX_set_options and SSL_CTX_get_options. This reduces the number of ivars we need and simplifies `ossl_sslctx_setup`. * ext/openssl/lib/openssl/ssl.rb (module OpenSSL): Default `options` to SSL_OP_ALL git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/openssl')
-rw-r--r--test/openssl/test_ssl.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb
index d319ba9aaa..1d3e1b51aa 100644
--- a/test/openssl/test_ssl.rb
+++ b/test/openssl/test_ssl.rb
@@ -10,6 +10,34 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
assert_equal(ctx.setup, nil)
end
+ def test_options_defaults_to_OP_ALL
+ ctx = OpenSSL::SSL::SSLContext.new
+ assert_equal OpenSSL::SSL::OP_ALL, ctx.options
+ end
+
+ def test_setting_twice
+ ctx = OpenSSL::SSL::SSLContext.new
+ ctx.options = 4
+ assert_equal 4, ctx.options
+ ctx.options = OpenSSL::SSL::OP_ALL
+ assert_equal OpenSSL::SSL::OP_ALL, ctx.options
+ end
+
+ def test_options_setting_nil_means_all
+ ctx = OpenSSL::SSL::SSLContext.new
+ ctx.options = nil
+ assert_equal OpenSSL::SSL::OP_ALL, ctx.options
+ end
+
+ def test_setting_options_raises_after_setup
+ ctx = OpenSSL::SSL::SSLContext.new
+ options = ctx.options
+ ctx.setup
+ assert_raises(RuntimeError) do
+ ctx.options = options
+ end
+ end
+
def test_ctx_setup_no_compression
ctx = OpenSSL::SSL::SSLContext.new
ctx.options = OpenSSL::SSL::OP_ALL | OpenSSL::SSL::OP_NO_COMPRESSION