summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-24 17:44:01 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-24 17:44:01 +0000
commit3d7473e1793f4885c7a84ac7992cf45697fe5e77 (patch)
treecca45ba48c6428c5afa064f12f1bac1c5e775784 /test
parent220f9d5053a3b981a01af6e7606298b0065c3e2c (diff)
ext/openssl/ossl_ssl.c: raise if kwargs given in blocking mode
OpenSSL::SSL::SSLSocket#sysread does not accept kwargs in blocking mode, inform users if they make an error. * ext/openssl/ossl_ssl.c (ossl_ssl_read_internal): do not process kwargs in blocking mode * test/openssl/test_ssl.rb: test sysread git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/openssl/test_ssl.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb
index 3ffddf8884..f2a64ca7c6 100644
--- a/test/openssl/test_ssl.rb
+++ b/test/openssl/test_ssl.rb
@@ -60,6 +60,20 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
}
end
+ def test_ssl_sysread_blocking_error
+ start_server(OpenSSL::SSL::VERIFY_NONE, true) { |server, port|
+ server_connect(port) { |ssl|
+ ssl.write("abc\n")
+ assert_raise(TypeError) { ssl.sysread(4, exception: false) }
+ buf = ''
+ assert_raise(ArgumentError) { ssl.sysread(4, buf, exception: false) }
+ assert_equal '', buf
+ assert_equal buf.object_id, ssl.sysread(4, buf).object_id
+ assert_equal "abc\n", buf
+ }
+ }
+ end
+
def test_connect_and_close
start_server(OpenSSL::SSL::VERIFY_NONE, true){|server, port|
sock = TCPSocket.new("127.0.0.1", port)