On Jan 24, 2007, at 07:31, Daniel Martin wrote:
> Probably, the function getline in ftp.rb should be modified to catch
> EOFError and turn it into an FTPProtoError, (the same type of error
> you'd get if the socket closed unexpectedly partway through a
> response) though the comments seem to indicate that the current
> situation is deliberate:
>
>     def getline
>       line = @sock.readline # if get EOF, raise EOFError
>       line.sub!(/(\r\n|\n|\r)\z/n, "")
>       if @debug_mode
>       print "get: ", sanitize(line), "\n"
>       end
>       return line
>     end
>     private :getline
>
> I contend that the current situation is a bug, and getline inside
> ftp.rb should read:
>
>     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
>
> At the very least, it should raise some sort of FTPError.

Can you propose a patch on the Ruby tracker?  You may need to  
subscribe to ruby-core to help get it committed.

-- 
Eric Hodel - drbrain / segment7.net - http://blog.segment7.net

I LIT YOUR GEM ON FIRE!