From ea0bf82630a1aa8ad6c56b9d50c297ba1aab6fb5 Mon Sep 17 00:00:00 2001 From: usa Date: Mon, 7 Jul 2014 03:17:25 +0000 Subject: merge revision(s) 46457,46458: [Backport #9949] * lib/net/ftp.rb (gets, readline): read lines without LF properly. [ruby-core:63205] [Bug #9949] * test/net/ftp/test_buffered_socket.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/net/ftp.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index c2cf5f3af4..20b8faa134 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -1102,13 +1102,16 @@ module Net end def gets - return readuntil("\n") - rescue EOFError - return nil + line = readuntil("\n", true) + return line.empty? ? nil : line end def readline - return readuntil("\n") + line = gets + if line.nil? + raise EOFError, "end of file reached" + end + return line end end # :startdoc: -- cgit v1.2.3