ruby-changes:36499
From: naruse <ko1@a...>
Date: Wed, 26 Nov 2014 17:22:39 +0900 (JST)
Subject: [ruby-changes:36499] naruse:r48581 (trunk): add test for r48563
naruse 2014-11-26 17:22:27 +0900 (Wed, 26 Nov 2014) New Revision: 48581 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48581 Log: add test for r48563 Modified files: trunk/test/net/http/test_https.rb Index: test/net/http/test_https.rb =================================================================== --- test/net/http/test_https.rb (revision 48580) +++ test/net/http/test_https.rb (revision 48581) @@ -73,12 +73,44 @@ class TestNetHTTPS < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/net/http/test_https.rb#L73 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 $! -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/