aboutsummaryrefslogtreecommitdiffstats
path: root/lib/net
diff options
context:
space:
mode:
Diffstat (limited to 'lib/net')
-rw-r--r--lib/net/ftp.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index 724f4b85bd..3c3353e9fe 100644
--- a/lib/net/ftp.rb
+++ b/lib/net/ftp.rb
@@ -298,16 +298,16 @@ module Net
# Receive a section of lines until the response code's match.
def getmultiline # :nodoc:
- line = getline
- buff = line
- if line[3] == ?-
- code = line[0, 3]
+ lines = []
+ lines << getline
+ code = lines.last.slice(/\A([0-9a-zA-Z]{3})-/, 1)
+ if code
+ delimiter = code + " "
begin
- line = getline
- buff << "\n" << line
- end until line[0, 3] == code and line[3] != ?-
+ lines << getline
+ end until lines.last.start_with?(delimiter)
end
- return buff << "\n"
+ return lines.join("\n") + "\n"
end
private :getmultiline