Fix problem with feature EPSV.

Some ftp servers report that they support EPSV while not.
This commit is contained in:
Davide D'Agostino 2015-01-23 13:51:27 -08:00
parent 80fcd9720b
commit bdf6fe6215

5
ftp.go
View File

@ -1,5 +1,5 @@
// Package ftp implements a FTP client as described in RFC 959. // Package ftp implements a FTP client as described in RFC 959.
package ftp package ftp // import "github.com/daddye/ftp"
import ( import (
"bufio" "bufio"
@ -205,9 +205,12 @@ func (c *ServerConn) openDataConn() (net.Conn, error) {
_, epsvSupported := c.features["EPSV"] _, epsvSupported := c.features["EPSV"]
if nat6Supported || epsvSupported { if nat6Supported || epsvSupported {
port, err = c.epsv() port, err = c.epsv()
if err != nil {
port, err = c.pasv()
if err != nil { if err != nil {
return nil, err return nil, err
} }
}
} else { } else {
port, err = c.pasv() port, err = c.pasv()
if err != nil { if err != nil {