aboutsummaryrefslogtreecommitdiffstats
path: root/test/net
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-25 00:05:59 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-25 00:05:59 +0000
commitead728ca7d7a42a3c1658d00102732947b514dea (patch)
tree7a79d8fa836b4922f05c3d118d8866457aed23ec /test/net
parentb8903f88f43b8dfa6e6bc0194182fffb83c07eb2 (diff)
downloadruby-ead728ca7d7a42a3c1658d00102732947b514dea.tar.gz
* 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
Diffstat (limited to 'test/net')
-rw-r--r--test/net/http/test_https.rb23
1 files changed, 23 insertions, 0 deletions
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)