ftp client hangs in 229 Entering Extended Passive Mode (|||5844|)
guglielmobartelloni opened this issue · comments
Describe the bug
As the title says when I trie to execute c.List("/")
the application hangs indefinetely. I read that could be a firewall issue but when I try to connect to the FTP server through Filezilla everything works fine.
To Reproduce
My code is the following:
c, err := ftp.Dial(
os.Getenv("ftpserver"),
ftp.DialWithExplicitTLS(
&tls.Config{
InsecureSkipVerify: true,
},
),
ftp.DialWithDebugOutput(os.Stdout),
ftp.DialWithTimeout(5*time.Second),
)
logErr(err)
err = c.Login(os.Getenv("username"), os.Getenv("password"))
logErr(err)
fmt.Println(c.List("/"))
if err := c.Quit(); err != nil {
log.Fatal(err)
}
Expected behavior
It should return the contents of the "/" dir
Debug output
220 (vsFTPd 3.0.3)
AUTH TLS
234 Proceed with negotiation.
USER user
331 Please specify the password.
PASS password
230 Login successful.
FEAT
211-Features:
AUTH TLS
UTF8
EPRT
EPSV
MDTM
PASV
PBSZ
PROT
REST STREAM
SIZE
TVFS
211 End
TYPE I
200 Switching to Binary mode.
OPTS UTF8 ON
200 Always in UTF8 mode.
PBSZ 0
200 PBSZ set to 0.
PROT P
200 PROT now Private.
EPSV
229 Entering Extended Passive Mode (|||6669|)
[] context deadline exceeded
QUIT
I have this same problem. Turning off EPSV, it hangs also in "Entering Passive Mode"
Looks like (|||6669|)
is an unexpected answer format...
#253 Looks like the same issue. Downgrading to v0.0.0-20220301011324-fed5bc26b7fa solved it for me.
Also seems related to #282
Try running this and see if the patch works for your cases as well.
go mod edit -replace github.com/jlaffaye/ftp/=github.com/ncw/ftp@2ead61ed085c02e810258109959144b5762b358d
Same.
Downgrading to v0.0.0-20220301011324-fed5bc26b7fa
solved it.
Should be fixed with #283