summaryrefslogtreecommitdiff
path: root/test/openssl/test_ssl_session.rb
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2025-02-06 23:48:26 +0900
committergit <svn-admin@ruby-lang.org>2025-02-09 10:26:07 +0000
commit581dbcec79b16ab55cf3548631cb34fe6db006ee (patch)
tree8c492a5855ef6cba26fee0bb09a60033f17bf280 /test/openssl/test_ssl_session.rb
parent64a98decf2d58754d9faefa30d9e86d79c63f805 (diff)
[ruby/openssl] ssl: prefer SSLContext#max_version= in tests
Avoid using the deprecated OpenSSL::SSL::SSLContext#ssl_version= outside the tests specifically written for it. https://github.com/ruby/openssl/commit/93a564dec2
Diffstat (limited to 'test/openssl/test_ssl_session.rb')
-rw-r--r--test/openssl/test_ssl_session.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/openssl/test_ssl_session.rb b/test/openssl/test_ssl_session.rb
index 0a9289136e..d1ef9cd3db 100644
--- a/test/openssl/test_ssl_session.rb
+++ b/test/openssl/test_ssl_session.rb
@@ -5,7 +5,9 @@ if defined?(OpenSSL::SSL)
class OpenSSL::TestSSLSession < OpenSSL::SSLTestCase
def test_session
- ctx_proc = proc { |ctx| ctx.ssl_version = :TLSv1_2 }
+ ctx_proc = proc { |ctx|
+ ctx.max_version = OpenSSL::SSL::TLS1_2_VERSION
+ }
start_server(ctx_proc: ctx_proc) do |port|
server_connect_with_session(port, nil, nil) { |ssl|
session = ssl.session
@@ -143,7 +145,7 @@ __EOS__
def test_server_session_cache
ctx_proc = Proc.new do |ctx|
- ctx.ssl_version = :TLSv1_2
+ ctx.max_version = OpenSSL::SSL::TLS1_2_VERSION
ctx.options |= OpenSSL::SSL::OP_NO_TICKET
end
@@ -197,7 +199,7 @@ __EOS__
10.times do |i|
connections = i
cctx = OpenSSL::SSL::SSLContext.new
- cctx.ssl_version = :TLSv1_2
+ cctx.max_version = OpenSSL::SSL::TLS1_2_VERSION
server_connect_with_session(port, cctx, first_session) { |ssl|
ssl.puts("abc"); assert_equal "abc\n", ssl.gets
first_session ||= ssl.session
@@ -299,11 +301,11 @@ __EOS__
connections = nil
called = {}
cctx = OpenSSL::SSL::SSLContext.new
- cctx.ssl_version = :TLSv1_2
+ cctx.max_version = OpenSSL::SSL::TLS1_2_VERSION
sctx = nil
ctx_proc = Proc.new { |ctx|
sctx = ctx
- ctx.ssl_version = :TLSv1_2
+ ctx.max_version = OpenSSL::SSL::TLS1_2_VERSION
ctx.options |= OpenSSL::SSL::OP_NO_TICKET
# get_cb is called whenever a client proposed to resume a session but