diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-08-30 01:28:45 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2016-08-30 01:49:59 +0900 |
commit | 3a926047a729f125df28946ede28f302d5c084ac (patch) | |
tree | 94712f38421c77ba6252b6ec73cc2764404bb487 /test | |
parent | 6eed9d0ca3a90bfcf64057cc00322f105b7ef5c8 (diff) | |
download | ruby-openssl-3a926047a729f125df28946ede28f302d5c084ac.tar.gz |
ssl: catch exceptions raised in ALPN/NPN callbacks
They aren't exception safe - they are called during parsing the
Client/Server Hello from OpenSSL code. An exception raised in the
callbacks escapes directly from OpenSSL code so it can break internal
status of OpenSSL.
We have a procedure for handling such exceptions raised during an
handshake: catch them and store the state number in the SSLSocket
object, and then check it in ossl_ssl_start() and re-raise after the
control turned back to our side.
This fixes the instability of
TestSSL::test_alpn_protocol_selection_cancel.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_ssl.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/test/test_ssl.rb b/test/test_ssl.rb index 1b9548a3..12f70224 100644 --- a/test/test_ssl.rb +++ b/test/test_ssl.rb @@ -1126,6 +1126,7 @@ if OpenSSL::OPENSSL_VERSION_NUMBER >= 0x10002000 assert_handshake_error { ssl2.connect } } assert_raise(TypeError) { ssl1.accept } + t.join ensure sock1&.close sock2&.close |