diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-09-06 18:12:03 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2016-09-07 08:53:08 +0900 |
commit | c6b0bc0e3a2ca82c6e8fb1d3a7f29764b654ca23 (patch) | |
tree | 18729cce2ddafda12d728804487dfa3677cb1ddb /test/utils.rb | |
parent | f69418511c707ac62cf7a23973a22865c8796ebe (diff) | |
download | ruby-openssl-c6b0bc0e3a2ca82c6e8fb1d3a7f29764b654ca23.tar.gz |
test/utils: make SSLTestCase#start_server take keyword arguments
Convert the two mandatory parameters, verify_mode and start_immediately,
into keyword arguments with a default value.
The verify_mode parameter is only useful for client certificate
authentication. So most test cases sets to OpenSSL::SSL::VERIFY_NONE.
Also the start_immediately option is usually set to true.
Diffstat (limited to 'test/utils.rb')
-rw-r--r-- | test/utils.rb | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/test/utils.rb b/test/utils.rb index 2288a260..4d055032 100644 --- a/test/utils.rb +++ b/test/utils.rb @@ -281,14 +281,10 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC end end - def start_server(verify_mode, start_immediately, args = {}, &block) + def start_server(verify_mode: OpenSSL::SSL::VERIFY_NONE, start_immediately: true, + ctx_proc: nil, server_proc: method(:readwrite_loop), + use_anon_cipher: false, ignore_listener_error: false, &block) IO.pipe {|stop_pipe_r, stop_pipe_w| - ctx_proc = args[:ctx_proc] - server_proc = args[:server_proc] - ignore_listener_error = args.fetch(:ignore_listener_error, false) - use_anon_cipher = args.fetch(:use_anon_cipher, false) - server_proc ||= method(:readwrite_loop) - store = OpenSSL::X509::Store.new store.add_cert(@ca_cert) store.purpose = OpenSSL::X509::PURPOSE_SSL_CLIENT @@ -296,7 +292,6 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC ctx.ciphers = "ADH-AES256-GCM-SHA384" if use_anon_cipher ctx.security_level = 0 if use_anon_cipher ctx.cert_store = store - #ctx.extra_chain_cert = [ ca_cert ] ctx.cert = @svr_cert ctx.key = @svr_key ctx.tmp_dh_callback = proc { OpenSSL::TestUtils::TEST_KEY_DH1024 } |