diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-01-28 19:31:48 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-01-28 19:31:48 +0000 |
commit | e25f3587bd426e87164c82678712571f99f4c2a8 (patch) | |
tree | 2c3d88783ed15bb0525e0514e7486725989d22b1 /test | |
parent | 2ee916752c7be930b2340a0eb8a0c1fcc8714532 (diff) | |
download | ruby-e25f3587bd426e87164c82678712571f99f4c2a8.tar.gz |
* 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
Diffstat (limited to 'test')
-rw-r--r-- | test/openssl/test_ssl.rb | 18 |
1 files changed, 18 insertions, 0 deletions
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) |