diff --git a/ftp.go b/ftp.go index 508b3c9..6161d61 100644 --- a/ftp.go +++ b/ftp.go @@ -135,16 +135,6 @@ func Dial(addr string, options ...DialOption) (*ServerConn, error) { c.conn = textproto.NewConn(do.wrapConn(tconn)) } - err = c.feat() - if err != nil { - c.Quit() - return nil, err - } - - if _, mlstSupported := c.features["MLST"]; mlstSupported { - c.mlstSupported = true - } - return c, nil } @@ -282,6 +272,15 @@ func (c *ServerConn) Login(user, password string) error { return errors.New(message) } + // Probe features + err = c.feat() + if err != nil { + return err + } + if _, mlstSupported := c.features["MLST"]; mlstSupported { + c.mlstSupported = true + } + // Switch to binary mode if _, _, err = c.cmd(StatusCommandOK, "TYPE I"); err != nil { return err