diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-06-29 18:08:43 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-06-29 18:08:43 +0000 |
commit | bdab29b10a0d65a3d6e1928449b5589aa05999b2 (patch) | |
tree | 1552855e30595fda89d644be5aed78fc6c78672b /lib | |
parent | dfba910f74d4f99961ad296a07fcc0617c2960a4 (diff) |
merge revision(s) r46457,r46458: [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_1@46618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/net/ftp.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index 0811b13b2d..a57372ac3b 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -1105,13 +1105,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: |