LINUX.ORG.RU

Инфа для Гоши

 ,


0

2

Пришлось тут с FTP (TLS) клиентом поработать. Перепробовал несколько популярных пакетов и ни в одном не смог получить список файлов.

Оказалось всё просто, спасибо Microsoft (полдня всего лишь убил).

In earlier versions of IIS, the FTP service returns a 125 Data connection already open; transfer starting response for APPE, STOU, and STOR commands sent by FTP clients when the client and server are communicating over a passive mode connection. Additionally, FTP returns a 150 File status okay; about to open data connection. response for the APPE, STOU, and STOR commands over active mode connections.

In FTP 7.5 and later versions, the response message does not depend on whether the request for the data connection is over passive mode or active mode. Instead, if the data connection is already established FTP 7.5 responds with 125 Data connection already open; transfer starting. If the data connection is not already established, FTP responds with 150 File status okay; about to open data connection.

https://docs.microsoft.com/en-us/troubleshoot/developer/webapps/iis/ftp-service-svchost-inetinfo/changes-in-ftp-7-5

Кто там на гитхабе остался «в живых»? Сделайте ишью.

Я этот сейчас использую (давно не обновлялся, но небольшой и работает норм): https://github.com/dutchcoders/goftp

602:func (ftp *FTP) List(path string) (files []string, err error)

if !strings.HasPrefix(line, StatusFileOK) {
    // MLSD failed, lets try LIST
    if err = ftp.send("LIST %s", path); err != nil {
        return
    }

    if line, err = ftp.receiveNoDiscard(); err != nil {
        return
    }

    if !strings.HasPrefix(line, StatusFileOK) {
        // Really list is not working here
        err = errors.New(line)
        return
    }
}

Добавить проверку дополнительно на 125 код. Другие пакеты не проверял, у кого есть желание - дерзайте!