From bdf6fe6215eb9229dbe01e5b62135960cfa912f6 Mon Sep 17 00:00:00 2001 From: Davide D'Agostino Date: Fri, 23 Jan 2015 13:51:27 -0800 Subject: [PATCH] Fix problem with feature EPSV. Some ftp servers report that they support EPSV while not. --- ftp.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ftp.go b/ftp.go index 5fe19fe..facdbae 100644 --- a/ftp.go +++ b/ftp.go @@ -1,5 +1,5 @@ // Package ftp implements a FTP client as described in RFC 959. -package ftp +package ftp // import "github.com/daddye/ftp" import ( "bufio" @@ -206,7 +206,10 @@ func (c *ServerConn) openDataConn() (net.Conn, error) { if nat6Supported || epsvSupported { port, err = c.epsv() if err != nil { - return nil, err + port, err = c.pasv() + if err != nil { + return nil, err + } } } else { port, err = c.pasv()