From e25f3587bd426e87164c82678712571f99f4c2a8 Mon Sep 17 00:00:00 2001 From: tenderlove Date: Tue, 28 Jan 2014 19:31:48 +0000 Subject: * ext/openssl/ossl_ssl.c: pass read_nonblock options to underlying IO when SSL session has not been started. * test/openssl/test_ssl.rb: test for change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/openssl/test_ssl.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/openssl') diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb index a13f0e1a9c..18c0bce95b 100644 --- a/test/openssl/test_ssl.rb +++ b/test/openssl/test_ssl.rb @@ -169,6 +169,24 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase } end + def test_read_nonblock_without_session + start_server(PORT, OpenSSL::SSL::VERIFY_NONE, false){|server, port| + sock = TCPSocket.new("127.0.0.1", port) + ssl = OpenSSL::SSL::SSLSocket.new(sock) + ssl.sync_close = true + + OpenSSL::TestUtils.silent do + assert_equal :wait_readable, ssl.read_nonblock(100, exception: false) + ssl.write("abc\n") + IO.select [ssl] + assert_equal('a', ssl.read_nonblock(1)) + assert_equal("bc\n", ssl.read_nonblock(100)) + assert_equal :wait_readable, ssl.read_nonblock(100, exception: false) + end + ssl.close + } + end + def test_starttls start_server(PORT, OpenSSL::SSL::VERIFY_NONE, false){|server, port| sock = TCPSocket.new("127.0.0.1", port) -- cgit v1.2.3