Skip to content

Commit e8db6ff

Browse files
committed
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.
1 parent 22ed31d commit e8db6ff

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

test/openssl/test_ssl.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,12 +1639,11 @@ def test_npn_protocol_selection_cancel
16391639
def test_npn_advertised_protocol_too_long
16401640
return unless OpenSSL::SSL::SSLContext.method_defined?(:npn_select_cb)
16411641

1642-
ctx_proc = Proc.new { |ctx| ctx.npn_protocols = ["a" * 256] }
1643-
start_server_version(:TLSv1_2, ctx_proc) { |port|
1644-
ctx = OpenSSL::SSL::SSLContext.new
1645-
ctx.npn_select_cb = -> (protocols) { protocols.first }
1646-
assert_handshake_error { server_connect(port, ctx) }
1647-
}
1642+
ctx = OpenSSL::SSL::SSLContext.new
1643+
assert_raise(OpenSSL::SSL::SSLError) do
1644+
ctx.npn_protocols = ["a" * 256]
1645+
ctx.setup
1646+
end
16481647
end
16491648

16501649
def test_npn_selected_protocol_too_long

0 commit comments

Comments
 (0)