From a8b36314ec22d0f8bcbad855ba8dc675654301bf Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Thu, 6 Feb 2025 23:55:49 +0900 Subject: [PATCH] [ruby/openssl] ssl: fix test case test_npn_advertised_protocol_too_long The list of NPN protocols is validated in SSLContext#setup. The assert_handshake_error is misleading. The client is unable to start a handshake at all because the server is not running. https://github.com/ruby/openssl/commit/e8db6ffd9e --- test/openssl/test_ssl.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb index 6497743644..711a94271b 100644 --- a/test/openssl/test_ssl.rb +++ b/test/openssl/test_ssl.rb @@ -1639,12 +1639,11 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase def test_npn_advertised_protocol_too_long return unless OpenSSL::SSL::SSLContext.method_defined?(:npn_select_cb) - ctx_proc = Proc.new { |ctx| ctx.npn_protocols = ["a" * 256] } - start_server_version(:TLSv1_2, ctx_proc) { |port| - ctx = OpenSSL::SSL::SSLContext.new - ctx.npn_select_cb = -> (protocols) { protocols.first } - assert_handshake_error { server_connect(port, ctx) } - } + ctx = OpenSSL::SSL::SSLContext.new + assert_raise(OpenSSL::SSL::SSLError) do + ctx.npn_protocols = ["a" * 256] + ctx.setup + end end def test_npn_selected_protocol_too_long