diff options
Diffstat (limited to 'test/net/http/test_https.rb')
-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 $! |