summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-19 00:28:41 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-19 00:28:41 +0000
commit7c371d465868986e3ac301ad99a1d3b7c3704a49 (patch)
tree42b1cd0a00081d4cc588621de0a7a8cf259c1987
parent3b17a1d0cf0097f9f9382cb2214f5af523bc11ed (diff)
* test/openssl/test_ssl.rb (class OpenSSL): Test
OpenSSL::SSL::SSLSocket#session and #session=. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--test/openssl/test_ssl.rb49
2 files changed, 54 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 259a8f8ace..cce2edf25f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Sep 19 09:28:06 2011 Eric Hodel <drbrain@segment7.net>
+
+ * test/openssl/test_ssl.rb (class OpenSSL): Test
+ OpenSSL::SSL::SSLSocket#session and #session=.
+
Mon Sep 19 07:54:17 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* object.c (rb_obj_clone): singleton class should be attached
diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb
index a081931bce..8811e39c91 100644
--- a/test/openssl/test_ssl.rb
+++ b/test/openssl/test_ssl.rb
@@ -166,6 +166,55 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
}
end
+ def test_session
+ start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true) { |_, port|
+ sock = TCPSocket.new '127.0.0.1', port
+ ctx = OpenSSL::SSL::SSLContext.new
+ ssl = OpenSSL::SSL::SSLSocket.new sock, ctx
+ ssl.connect
+
+ session = OpenSSL::SSL::Session.new ssl
+
+ assert_equal session, ssl.session
+ }
+ end
+
+ def test_session_equals
+ session = OpenSSL::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fi+5k8uN3qS+gOU/PPrmHGgl5ykiSFgqs4v61
+tddwpBAEDjcwMzA5NTYzMTU1MzAwpQMCARM=
+-----END SSL SESSION PARAMETERS-----
+ SESSION
+
+ start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true) { |_, port|
+ ctx = OpenSSL::SSL::SSLContext.new
+ ctx.session_cache_mode = OpenSSL::SSL::SSLContext::SESSION_CACHE_CLIENT
+ ctx.session_id_context = self.object_id.to_s
+
+ sock = TCPSocket.new '127.0.0.1', port
+ ssl = OpenSSL::SSL::SSLSocket.new sock, ctx
+ ssl.session = session
+
+ assert_equal session, ssl.session
+ }
+ end
+
def test_starttls
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, false){|server, port|
sock = TCPSocket.new("127.0.0.1", port)