@@ -15,11 +15,16 @@ def test_bad_socket
1515 end
1616 end
1717
18+ def test_ctx_setup
19+ ctx = OpenSSL ::SSL ::SSLContext . new
20+ assert_equal true , ctx . setup
21+ assert_predicate ctx , :frozen?
22+ assert_equal nil , ctx . setup
23+ end
24+
1825 def test_ctx_options
1926 ctx = OpenSSL ::SSL ::SSLContext . new
2027
21- assert ( OpenSSL ::SSL ::OP_ALL & ctx . options ) == OpenSSL ::SSL ::OP_ALL ,
22- "OP_ALL is set by default"
2328 ctx . options = 4
2429 assert_equal 4 , ctx . options & 4
2530 if ctx . options != 4
@@ -33,6 +38,31 @@ def test_ctx_options
3338 assert_equal nil , ctx . setup
3439 end
3540
41+ def test_ctx_options_config
42+ omit "LibreSSL does not support OPENSSL_CONF" if libressl?
43+ omit "OpenSSL < 1.1.1 does not support system_default" if openssl? && !openssl? ( 1 , 1 , 1 )
44+
45+ Tempfile . create ( "openssl.cnf" ) { |f |
46+ f . puts ( <<~EOF )
47+ openssl_conf = default_conf
48+ [default_conf]
49+ ssl_conf = ssl_sect
50+ [ssl_sect]
51+ system_default = ssl_default_sect
52+ [ssl_default_sect]
53+ Options = -SessionTicket
54+ EOF
55+ f . close
56+
57+ assert_separately ( [ { "OPENSSL_CONF" => f . path } , "-ropenssl" ] , <<~"end;" )
58+ ctx = OpenSSL::SSL::SSLContext.new
59+ assert_equal OpenSSL::SSL::OP_NO_TICKET, ctx.options & OpenSSL::SSL::OP_NO_TICKET
60+ ctx.set_params
61+ assert_equal OpenSSL::SSL::OP_NO_TICKET, ctx.options & OpenSSL::SSL::OP_NO_TICKET
62+ end;
63+ }
64+ end
65+
3666 def test_ssl_with_server_cert
3767 ctx_proc = -> ctx {
3868 ctx . cert = @svr_cert
0 commit comments