Try EPSV when PASV fails
This commit is contained in:
parent
a3bb5b8714
commit
6bad3e176c
13
ftp.go
13
ftp.go
@ -200,20 +200,15 @@ func (c *ServerConn) openDataConn() (net.Conn, error) {
|
|||||||
// else -> PASV
|
// else -> PASV
|
||||||
_, nat6Supported := c.features["nat6"]
|
_, nat6Supported := c.features["nat6"]
|
||||||
_, epsvSupported := c.features["EPSV"]
|
_, epsvSupported := c.features["EPSV"]
|
||||||
// If host is IPv6 => EPSV
|
|
||||||
if strings.ContainsAny(c.host, ":%") {
|
if !nat6Supported && !epsvSupported {
|
||||||
epsvSupported = true
|
port, _ = c.pasv()
|
||||||
}
|
}
|
||||||
if nat6Supported || epsvSupported {
|
if port == 0 {
|
||||||
port, err = c.epsv()
|
port, err = c.epsv()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
port, err = c.pasv()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the new net address string
|
// Build the new net address string
|
||||||
|
Loading…
Reference in New Issue
Block a user