summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-04 07:21:10 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-04 07:21:10 +0000
commiteaee5fc3fd30aac0ca7fc79dc9d27a7fe8991925 (patch)
tree022d2d46e4b5f70369f1661abf7206a7dc37319b /test
parent7575b13e572f94bd82db880cc5b2af8d5a545513 (diff)
downloadruby-eaee5fc3fd30aac0ca7fc79dc9d27a7fe8991925.tar.gz
ruby-eaee5fc3fd30aac0ca7fc79dc9d27a7fe8991925.tar.xz
ruby-eaee5fc3fd30aac0ca7fc79dc9d27a7fe8991925.zip
* ext/openssl/ossl_ssl.c (ossl_ssl_read_nonblock):
OpenSSL::SSL::SSLSocket should implement read_nonblock. a patch from Aaron Patterson in [ruby-core:20277]. fix: #814 [ruby-core:20241] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/openssl/test_ssl.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb
index 44e79c9e2..9010fd2e9 100644
--- a/test/openssl/test_ssl.rb
+++ b/test/openssl/test_ssl.rb
@@ -166,6 +166,21 @@ class OpenSSL::TestSSL < Test::Unit::TestCase
assert_equal(ctx.setup, nil)
end
+ def test_ssl_read_nonblock
+ 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
+ assert_raise(Errno::EAGAIN, Errno::EWOULDBLOCK) { ssl.read_nonblock(100) }
+ ssl.write("abc\n")
+ IO.select [ssl]
+ assert_equal('a', ssl.read_nonblock(1))
+ assert_equal("bc\n", ssl.read_nonblock(100))
+ assert_raise(Errno::EAGAIN, Errno::EWOULDBLOCK) { ssl.read_nonblock(100) }
+ }
+ end
+
def test_connect_and_close
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port|
sock = TCPSocket.new("127.0.0.1", port)