summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl_ssl.c
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 /ext/openssl/ossl_ssl.c
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 'ext/openssl/ossl_ssl.c')
-rw-r--r--ext/openssl/ossl_ssl.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index ce8ce8935c..4496d46ab7 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -1430,13 +1430,17 @@ ossl_ssl_read_internal(int argc, VALUE *argv, VALUE self, int nonblock)
{
SSL *ssl;
int ilen, nread = 0;
- int no_exception;
+ int no_exception = 0;
VALUE len, str;
rb_io_t *fptr;
VALUE opts = Qnil;
- rb_scan_args(argc, argv, "11:", &len, &str, &opts);
- no_exception = get_no_exception(opts);
+ if (nonblock) {
+ rb_scan_args(argc, argv, "11:", &len, &str, &opts);
+ no_exception = get_no_exception(opts);
+ } else {
+ rb_scan_args(argc, argv, "11", &len, &str);
+ }
ilen = NUM2INT(len);
if(NIL_P(str)) str = rb_str_new(0, ilen);