summaryrefslogtreecommitdiff
path: root/test/openssl
diff options
context:
space:
mode:
authoremboss <emboss@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-15 02:04:07 +0000
committeremboss <emboss@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-15 02:04:07 +0000
commitd6b1ab91dcf83536ea7d94f2b855e8ce21802136 (patch)
treed57eaa5544f3461c9eb31a0a0120d2b738197d28 /test/openssl
parente4f6efcc4a830b94634e2461ffbc564040344058 (diff)
* ext/openssl/ossl_ssl.c: Correct shutdown behavior w.r.t GC.
* test/openssl/test_ssl.rb: Add tests to verify correct behavior. [Bug #8240] Patch provided by Shugo Maeda. Thanks! git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/openssl')
-rw-r--r--test/openssl/test_ssl.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb
index cb18c1ae51..f3c1aacaf0 100644
--- a/test/openssl/test_ssl.rb
+++ b/test/openssl/test_ssl.rb
@@ -592,6 +592,33 @@ if OpenSSL::OPENSSL_VERSION_NUMBER > 0x10001000
end
+ def test_invalid_shutdown_by_gc
+ assert_nothing_raised {
+ start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port|
+ 10.times {
+ sock = TCPSocket.new("127.0.0.1", port)
+ ssl = OpenSSL::SSL::SSLSocket.new(sock)
+ GC.start
+ ssl.connect
+ sock.close
+ }
+ }
+ }
+ end
+
+ def test_close_after_socket_close
+ start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port|
+ sock = TCPSocket.new("127.0.0.1", port)
+ ssl = OpenSSL::SSL::SSLSocket.new(sock)
+ ssl.sync_close = true
+ ssl.connect
+ sock.close
+ assert_nothing_raised do
+ ssl.close
+ end
+ }
+ end
+
private
def start_server_version(version, ctx_proc=nil, server_proc=nil, &blk)