diff options
author | emboss <emboss@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-06-09 16:44:12 +0000 |
---|---|---|
committer | emboss <emboss@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-06-09 16:44:12 +0000 |
commit | 14ba7fab58329201aebdc49b83ca96dfbf0b13e6 (patch) | |
tree | 2dbf568e4e75f8044afb05ecc6da772d7bafa2ed /test/openssl | |
parent | f45eb45100e7a655c25629354c0a1c48c363360c (diff) |
* ext/openssl/ossl_ssl.c: Introduce SSLContext#renegotiation_cb and
remove SSLContext#disable_client_renegotiation and related
functionality introduced in r35797. The new callback approach
gives clients maximum flexibility to decide on their own what to
do on renegotiation attempts.
Add documentation for SSL module and SSLError.
* test/openssl/test_ssl.rb: Add a test for
SSLContext#renegotiation_cb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/openssl')
-rw-r--r-- | test/openssl/test_ssl.rb | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb index 97b2c22472..97a3a46169 100644 --- a/test/openssl/test_ssl.rb +++ b/test/openssl/test_ssl.rb @@ -505,39 +505,17 @@ if OpenSSL::SSL::SSLContext::METHODS.include? :TLSv1_2 end - def test_disable_client_renegotiation - ctx_proc = Proc.new { |ctx| ctx.disable_client_renegotiation } + def test_renegotiation_cb + num_handshakes = 0 + renegotiation_cb = Proc.new { |ssl| num_handshakes += 1 } + ctx_proc = Proc.new { |ctx| ctx.renegotiation_cb = renegotiation_cb } start_server_version(:SSLv23, ctx_proc) { |server, port| server_connect(port) { |ssl| - assert(ssl.ssl_version) + assert_equal(1, num_handshakes) } } end - - def test_allow_client_renegotiation_args - ctx = OpenSSL::SSL::SSLContext.new - assert_raise(ArgumentError) { ctx.allow_client_renegotiation(0) } - assert_raise(ArgumentError) { ctx.allow_client_renegotiation(-1) } - end - - def test_allow_client_renegotiation_once - ctx_proc = Proc.new { |ctx| ctx.allow_client_renegotiation(2) } - start_server_version(:SSLv23, ctx_proc) { |server, port| - server_connect(port) { |ssl| - assert(ssl.ssl_version) - } - } - end - - def test_allow_arbitrary_client_renegotiation - ctx_proc = Proc.new { |ctx| ctx.allow_client_renegotiation } - start_server_version(:SSLv23, ctx_proc) { |server, port| - server_connect(port) { |ssl| - assert(ssl.ssl_version) - } - } - end - + private def start_server_version(version, ctx_proc=nil, server_proc=nil, &blk) |