From d3236ba3b4652eb9e66474b4fe6642a1d2884cbf Mon Sep 17 00:00:00 2001 From: naruse Date: Wed, 26 Nov 2014 08:22:27 +0000 Subject: add test for r48563 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/net/http/test_https.rb | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'test/net/http') 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 $! -- cgit v1.2.3