mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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 <bar.hofesh@safe-t.com> 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
This commit is contained in:
parent
9cf11b70ca
commit
1e5a40ff18
3 changed files with 18 additions and 1 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
Sun Aug 2 07:01:17 2015 Eric Wong <e@80x24.org>
|
||||||
|
|
||||||
|
* 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 <bar.hofesh@safe-t.com> for the bug report
|
||||||
|
and testing.
|
||||||
|
[ruby-core:70149] [Bug #11400]
|
||||||
|
|
||||||
Sat Aug 1 17:13:15 2015 Kazuki Tsujimoto <kazuki@callcc.net>
|
Sat Aug 1 17:13:15 2015 Kazuki Tsujimoto <kazuki@callcc.net>
|
||||||
|
|
||||||
* lib/net/http/response.rb (Net::HTTPResponse::Inflater#finish):
|
* lib/net/http/response.rb (Net::HTTPResponse::Inflater#finish):
|
||||||
|
|
|
@ -213,7 +213,7 @@ module OpenSSL::Buffering
|
||||||
else
|
else
|
||||||
size = idx ? idx+eol.size : nil
|
size = idx ? idx+eol.size : nil
|
||||||
end
|
end
|
||||||
if limit and limit >= 0
|
if size && limit && limit >= 0
|
||||||
size = [size, limit].min
|
size = [size, limit].min
|
||||||
end
|
end
|
||||||
consume_rbuff(size)
|
consume_rbuff(size)
|
||||||
|
|
|
@ -110,6 +110,14 @@ module OpenSSL::TestPairM
|
||||||
}
|
}
|
||||||
end
|
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
|
def test_readpartial
|
||||||
ssl_pair {|s1, s2|
|
ssl_pair {|s1, s2|
|
||||||
s2.write "a\nbcd"
|
s2.write "a\nbcd"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue