From 425b40600386d488a76ccea298a266136c15f5a7 Mon Sep 17 00:00:00 2001 From: normal Date: Sat, 1 Aug 2015 22:08:17 +0000 Subject: openssl/buffering: fix gets on EOF with limit * ext/openssl/lib/openssl/buffering.rb (gets): avoid comparing fixnum with nil * test/openssl/test_pair.rb: test gets with limit when EOF is hit Thanks to Bar Hofesh for the bug report and testing. [ruby-core:70149] [Bug #11400] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/openssl/test_pair.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/openssl') diff --git a/test/openssl/test_pair.rb b/test/openssl/test_pair.rb index 8e4aefce31..977d11a259 100644 --- a/test/openssl/test_pair.rb +++ b/test/openssl/test_pair.rb @@ -110,6 +110,14 @@ module OpenSSL::TestPairM } end + def test_gets_eof_limit + ssl_pair {|s1, s2| + s1.write("hello") + s1.close # trigger EOF + assert_match "hello", s2.gets("\n", 6), "[ruby-core:70149] [Bug #11140]" + } + end + def test_readpartial ssl_pair {|s1, s2| s2.write "a\nbcd" -- cgit v1.2.3