parent
4596ddad4d
commit
de604c9776
@ -33,7 +33,7 @@ func testConn(t *testing.T, disableEPSV bool) {
|
|||||||
|
|
||||||
if disableEPSV {
|
if disableEPSV {
|
||||||
delete(c.features, "EPSV")
|
delete(c.features, "EPSV")
|
||||||
c.disableEPSV = true
|
c.DisableEPSV = true
|
||||||
}
|
}
|
||||||
|
|
||||||
err = c.Login("anonymous", "anonymous")
|
err = c.Login("anonymous", "anonymous")
|
||||||
|
8
ftp.go
8
ftp.go
@ -24,11 +24,13 @@ const (
|
|||||||
|
|
||||||
// ServerConn represents the connection to a remote FTP server.
|
// ServerConn represents the connection to a remote FTP server.
|
||||||
type ServerConn struct {
|
type ServerConn struct {
|
||||||
|
// Do not use EPSV mode
|
||||||
|
DisableEPSV bool
|
||||||
|
|
||||||
conn *textproto.Conn
|
conn *textproto.Conn
|
||||||
host string
|
host string
|
||||||
timeout time.Duration
|
timeout time.Duration
|
||||||
features map[string]string
|
features map[string]string
|
||||||
disableEPSV bool
|
|
||||||
mlstSupported bool
|
mlstSupported bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,13 +252,13 @@ func (c *ServerConn) pasv() (port int, err error) {
|
|||||||
// getDataConnPort returns a port for a new data connection
|
// getDataConnPort returns a port for a new data connection
|
||||||
// it uses the best available method to do so
|
// it uses the best available method to do so
|
||||||
func (c *ServerConn) getDataConnPort() (int, error) {
|
func (c *ServerConn) getDataConnPort() (int, error) {
|
||||||
if !c.disableEPSV {
|
if !c.DisableEPSV {
|
||||||
if port, err := c.epsv(); err == nil {
|
if port, err := c.epsv(); err == nil {
|
||||||
return port, nil
|
return port, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// if there is an error, disable EPSV for the next attempts
|
// if there is an error, disable EPSV for the next attempts
|
||||||
c.disableEPSV = true
|
c.DisableEPSV = true
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.pasv()
|
return c.pasv()
|
||||||
|
Loading…
Reference in New Issue
Block a user