Patches item #8127, was opened at 2007-01-24 21:05
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1700&aid=8127&group_id=426

Category: None
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Daniel Martin (fizbin)
Assigned to: Nobody (None)
Summary: ftp.rb raises an error that is not an FTPError on certain error conditions

Initial Comment:
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.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1700&aid=8127&group_id=426