summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2025-02-06 23:55:49 +0900
committergit <svn-admin@ruby-lang.org>2025-02-09 10:26:06 +0000
commita8b36314ec22d0f8bcbad855ba8dc675654301bf (patch)
tree821100dfc99be50a783ae2e659cc6611d8a52b62
parent1f4fc2e608b009599dab3413ea9c04746ae65d90 (diff)
[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
-rw-r--r--test/openssl/test_ssl.rb11
1 files 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