For more context, see ruby-talk:235896
If the server that ftp.rb is talking to unexpectedly closes the control connection in between responses, ftp.rb ends
up raising an EOFError. This is highly confusing to the user, since any other server error generally causes an FTPError
(or one of its subclasses).
Specifically, if an ftp server is overloaded with open connections such that subsequent connection requests have it
accept the connection but immediately close it (this happens easily with inetd-based servers), then FTP.open will raise
EOFError.
This is very confusing, and I think it a bug.
Therefore, the definition of getline in ftp.rb should be:
def getline
begin
line = @sock.readline # if get EOF, raise EOFError
rescue EOFError
raise FTPProtoError, "Connection closed unexpectedly"
end
line.sub!(/(\r\n|\n|\r)\z/n, "")
if @debug_mode
print "get: ", sanitize(line), "\n"
end
return line
end
private :getline
Instead of what it is now. |