summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-31 08:18:12 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-31 08:18:12 +0000
commit021aaa70d6c9e10f62dacba0a9a54ef6723ea170 (patch)
tree14fb4187a8a517976316949b707d5bef651f3d94
parent67d66b2652a955c8dfcf2377f2842e1c413e0939 (diff)
* ext/openssl/ossl_ssl.c (ossl_ssl_read_internal): show openssl error
code in EWOULDBLOCK error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--ext/openssl/ossl_ssl.c4
-rw-r--r--test/openssl/test_pair.rb10
3 files changed, 16 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 0e0fe96572..d9e0236f3b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Dec 31 17:16:46 2008 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_ssl.c (ossl_ssl_read_internal): show openssl error
+ code in EWOULDBLOCK error.
+
Wed Dec 31 15:45:18 2008 Tanaka Akira <akr@fsij.org>
* io.c (copy_stream_body): don't check to_io because
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index 310e0c5783..08818ac8ab 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -1024,14 +1024,14 @@ ossl_ssl_read_internal(int argc, VALUE *argv, VALUE self, int nonblock)
case SSL_ERROR_WANT_WRITE:
if (nonblock) {
errno = EWOULDBLOCK;
- rb_sys_fail(0);
+ rb_sys_fail("SSL_ERROR_WANT_WRITE");
}
rb_io_wait_writable(FPTR_TO_FD(fptr));
continue;
case SSL_ERROR_WANT_READ:
if (nonblock) {
errno = EWOULDBLOCK;
- rb_sys_fail(0);
+ rb_sys_fail("SSL_ERROR_WANT_READ");
}
rb_io_wait_readable(FPTR_TO_FD(fptr));
continue;
diff --git a/test/openssl/test_pair.rb b/test/openssl/test_pair.rb
index 66d8ebc83f..ea8fc773cb 100644
--- a/test/openssl/test_pair.rb
+++ b/test/openssl/test_pair.rb
@@ -146,7 +146,15 @@ class OpenSSL::TestPair < Test::Unit::TestCase
def test_read_nonblock
ssl_pair {|s1, s2|
- assert_raise(Errno::EWOULDBLOCK) { s2.read_nonblock(10) }
+ err = nil
+ assert_raise(Errno::EWOULDBLOCK) {
+ begin
+ s2.read_nonblock(10)
+ ensure
+ err = $!
+ end
+ }
+ assert_match(/SSL_ERROR_WANT_READ/, err.message)
s1.write "abc\ndef\n"
assert_equal("ab", s2.read_nonblock(2))
assert_equal("c\n", s2.gets)