summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-08 20:27:01 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-08 20:27:01 +0000
commit83d705f6a06eef70f9eb219ba7f187555f00ede8 (patch)
tree6f0b9924026e69795c0937e01dc0054ee742524b
parente23a564ac67681946802121caba056805cc658ff (diff)
merge revision(s) 51016,53329: [Backport #11885]
* ext/openssl/ossl_ssl.c (ossl_ssl_read_internal): do not process kwargs in blocking mode * test/openssl/test_ssl.rb: test sysread * io.c (io_getpartial): remove unused kwarg from template * test/ruby/test_io.rb (test_readpartial_bad_args): new [Bug #11885] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@54045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog12
-rw-r--r--ext/openssl/ossl_ssl.c6
-rw-r--r--io.c4
-rw-r--r--test/openssl/test_ssl.rb14
-rw-r--r--version.h2
5 files changed, 35 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 1d37e43af7..37fd1d446e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Wed Mar 9 05:14:20 2016 Eric Wong <e@80x24.org>
+
+ * io.c (io_getpartial): remove unused kwarg from template
+ * test/ruby/test_io.rb (test_readpartial_bad_args): new
+ [Bug #11885]
+
+Wed Mar 9 05:14:20 2016 Eric Wong <e@80x24.org>
+
+ * ext/openssl/ossl_ssl.c (ossl_ssl_read_internal):
+ do not process kwargs in blocking mode
+ * test/openssl/test_ssl.rb: test sysread
+
Wed Mar 9 04:21:02 2016 NAKAMURA Usaku <usa@ruby-lang.org>
* process.c (rb_execarg_parent_start1): need to convert the encoding to
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index 6e777c9119..79e92fd76b 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -1423,7 +1423,11 @@ ossl_ssl_read_internal(int argc, VALUE *argv, VALUE self, int nonblock)
rb_io_t *fptr;
VALUE opts = Qnil;
- rb_scan_args(argc, argv, "11:", &len, &str, &opts);
+ if (nonblock) {
+ rb_scan_args(argc, argv, "11:", &len, &str, &opts);
+ } else {
+ rb_scan_args(argc, argv, "11", &len, &str);
+ }
if (!NIL_P(opts) && Qfalse == rb_hash_aref(opts, sym_exception))
no_exception = 1;
diff --git a/io.c b/io.c
index 33b389b82e..6f73953609 100644
--- a/io.c
+++ b/io.c
@@ -2675,8 +2675,10 @@ io_read_nonblock(int argc, VALUE *argv, VALUE io)
rb_scan_args(argc, argv, "11:", NULL, NULL, &opts);
- if (!NIL_P(opts) && Qfalse == get_kwargs_exception(opts))
+ if (!NIL_P(opts) && Qfalse == get_kwargs_exception(opts)) {
no_exception = 1;
+ argc--;
+ }
ret = io_getpartial(argc, argv, io, 1, no_exception);
diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb
index 4445f06762..7f180f0a43 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)
diff --git a/version.h b/version.h
index ae26c54247..847cf7e646 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.2.5"
#define RUBY_RELEASE_DATE "2016-03-09"
-#define RUBY_PATCHLEVEL 249
+#define RUBY_PATCHLEVEL 250
#define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 3