jlaffaye/goftp — Issue #1: List function seems take much more time 
Author: ZhuBicen
Created: 2012-02-23 13:21:16+00:00
State: open

Thanks you for making this library.
I found a issue: It take about several minutes to execute the 'List' function.
and also I used the printf trying to find the cause. It seems this line of code
looks like blocked:
for {
line, e := bio.ReadString('\n')
if e == io.EOF {// <<<<<<<<<<<<<<<<<<<
fmt.Println("Received EOF")
break
} else if e != nil {
return nil, e
}
fmt.Println(line)
entry, err := parseListLine(line)
if err == nil {
entries = append(entries, entry)
}
}

After the changing, I can see the list lines can be displayed quickly,
But then a few minutes later, it print out the "Received EOF".

Firstly I read through your code, seems nothing wrong, and I am trying
to reproduce this issue by using the go native library, but I can't reproduce
it by following code, it can return quickly,

conn, _ := textproto.Dial("tcp", "localhost:21"
message, _ := conn.ReadLine()
fmt.Println(message)

conn.Cmd("USER bzhu")
message, _ = conn.ReadLine()
fmt.Println(message)

conn.Cmd("PASS 123")
message, _ = conn.ReadLine()
fmt.Println(message)

conn.Cmd("EPSV")
message, _ = conn.ReadLine()
fmt.Println(message)
start := strings.Index(message, "|||")
end := strings.LastIndex(message, "|")
port, _ := strconv.Atoi(message[start+3 :end])

fmt.Printf("port = %d\n", port)
addr := fmt.Sprintf("localhost:%d", port)
conn2, _ := net.Dial("tcp", addr)

conn.Cmd("LIST /home/bzhu/")
bio := bufio.NewReader(conn2)

for{
line, e := bio.ReadString('\n')
if e == io.EOF {
fmt.Printf("Break by EOF\n")
break
}
fmt.Printf("get line: %s\n", line)
}

Could you help check ?