From 66a09f43d5c9497d642111ea8a2838ec178a35df Mon Sep 17 00:00:00 2001 From: SunRunAway Date: Mon, 8 Jul 2013 13:48:11 +0800 Subject: [PATCH] use ReadResponse @Connect --- client_test.go | 17 +++++++++++++++++ ftp.go | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/client_test.go b/client_test.go index 65bcef6..0291bdc 100644 --- a/client_test.go +++ b/client_test.go @@ -103,3 +103,20 @@ func TestConn(t *testing.T) { t.Error("Expected error") } } + +func TestConn2(t *testing.T) { + c, err := Connect("ftp.mozilla.org:21") + if err != nil { + t.Fatal(err) + } + + err = c.Login("anonymous", "anonymous") + if err != nil { + t.Fatal(err) + } + + _, err = c.List(".") + if err != nil { + t.Error(err) + } +} diff --git a/ftp.go b/ftp.go index 6e8b0f8..2134fa6 100644 --- a/ftp.go +++ b/ftp.go @@ -58,7 +58,7 @@ func Connect(addr string) (*ServerConn, error) { features: make(map[string]string), } - _, _, err = c.conn.ReadCodeLine(StatusReady) + _, _, err = c.conn.ReadResponse(StatusReady) if err != nil { c.Quit() return nil, err