summaryrefslogtreecommitdiff
path: root/lib/net
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-17 07:44:53 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-17 07:44:53 +0000
commit6479e0b04fd685d0ebe8dd4b198ffec6ad6baa1c (patch)
tree71755f4fd0fcac16161e3e7a2be22210c5ab7456 /lib/net
parentd689dca633e979bb888a6a287a07e0084a0f5187 (diff)
* 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/trunk@46457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net')
-rw-r--r--lib/net/ftp.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index eabe6f5f08..6b452b8a75 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: