From ead728ca7d7a42a3c1658d00102732947b514dea Mon Sep 17 00:00:00 2001 From: drbrain Date: Wed, 25 Jul 2012 00:05:59 +0000 Subject: * lib/net/http.rb: Added SSL session reuse across connections for a single instance to speed up connection. [Feature #5341] * NEWS: ditto * test/net/http/test_https.rb: Tests for #5341 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/net/http/test_https.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test/net') diff --git a/test/net/http/test_https.rb b/test/net/http/test_https.rb index 3b843b140f..2a42db7209 100644 --- a/test/net/http/test_https.rb +++ b/test/net/http/test_https.rb @@ -59,6 +59,29 @@ class TestNetHTTPS < Test::Unit::TestCase skip $! end + def test_session_reuse + 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.start + http.get("/") + http.finish + + http.start + http.get("/") + http.finish # three times due to possible bug in OpenSSL 0.9.8 + + http.start + http.get("/") + + socket = http.instance_variable_get(:@socket).io + + assert socket.session_reused? + end + if ENV["RUBY_OPENSSL_TEST_ALL"] def test_verify http = Net::HTTP.new("ssl.netlab.jp", 443) -- cgit v1.2.3