use utf8 default
This commit is contained in:
parent
95f4fe9d35
commit
bb08d6425f
24
ftp.go
24
ftp.go
@ -95,6 +95,12 @@ func DialTimeout(addr string, timeout time.Duration) (*ServerConn, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = c.setUTF8()
|
||||||
|
if err != nil {
|
||||||
|
c.Quit()
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,6 +171,24 @@ func (c *ServerConn) feat() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setUTF8 issues an "OPTS UTF8 ON" command.
|
||||||
|
func (c *ServerConn) setUTF8() error {
|
||||||
|
if _, ok := c.features["UTF8"]; !ok {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
code, message, err := c.cmd(-1, "OPTS UTF8 ON")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if code != StatusCommandOK {
|
||||||
|
return errors.New(message)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// epsv issues an "EPSV" command to get a port number for a data connection.
|
// epsv issues an "EPSV" command to get a port number for a data connection.
|
||||||
func (c *ServerConn) epsv() (port int, err error) {
|
func (c *ServerConn) epsv() (port int, err error) {
|
||||||
_, line, err := c.cmd(StatusExtendedPassiveMode, "EPSV")
|
_, line, err := c.cmd(StatusExtendedPassiveMode, "EPSV")
|
||||||
|
Loading…
Reference in New Issue
Block a user