diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-26 08:22:27 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-26 08:22:27 +0000 |
commit | d3236ba3b4652eb9e66474b4fe6642a1d2884cbf (patch) | |
tree | de8a525bf7142b4d0a1b393ccc8cdd40d3c0f6d3 /test | |
parent | 058044c211b48027fe84191571527a464b57036a (diff) | |
download | ruby-d3236ba3b4652eb9e66474b4fe6642a1d2884cbf.tar.gz |
add test for r48563
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/net/http/test_https.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/net/http/test_https.rb b/test/net/http/test_https.rb index bff2b4afe6..486375a55c 100644 --- a/test/net/http/test_https.rb +++ b/test/net/http/test_https.rb @@ -73,12 +73,44 @@ class TestNetHTTPS < Test::Unit::TestCase http.get("/") http.finish # three times due to possible bug in OpenSSL 0.9.8 + sid = http.instance_variable_get(:@ssl_session).id + http.start http.get("/") socket = http.instance_variable_get(:@socket).io assert socket.session_reused? + + assert_equal sid, http.instance_variable_get(:@ssl_session).id + + http.finish + rescue SystemCallError + skip $! + end + + def test_session_reuse_but_expire + http = Net::HTTP.new("localhost", config("port")) + http.use_ssl = true + http.verify_callback = Proc.new do |preverify_ok, store_ctx| + store_ctx.current_cert.to_der == config('ssl_certificate').to_der + end + + http.ssl_timeout = -1 + http.start + http.get("/") + http.finish + + sid = http.instance_variable_get(:@ssl_session).id + + http.start + http.get("/") + + socket = http.instance_variable_get(:@socket).io + assert_equal false, socket.session_reused? + + assert_not_equal sid, http.instance_variable_get(:@ssl_session).id + http.finish rescue SystemCallError skip $! |