miyako/4d-plugin-curl-v3

cURL_FTP_GetDirList doesn't work reliably

joerg-eyring opened this issue · 6 comments

Hi Keisuke,

I made extensive tests with your new cURL plugin. Here are my experiences with "cURL_FTP_GetDirList":

macOS:
FTP:
$options:=New object
$options.URL:="ftp://ftp.server.de/subDir/"
$options.USERNAME:=$user
$options.PASSWORD:=$pw
$status:=cURL_FTP_GetDirList($options; "")

$status.status yields 0 -> OK
$status.dirList contains:
drwxrwxrwx folder 0 Feb 11 2020 de.lproj
drwxrwxrwx folder 0 Feb 11 2020 ftp_test
-rw-rw-rw- 0 584975 584975 Jun 8 2020 ocr-0.2.zip
drwxrwxrwx folder 0 Jun 8 2020 ordner1
drwxrwxrwx folder 0 Feb 15 2020 ordner2
drwxrwxrwx folder 0 Jul 9 16:43 privat2

All entries except the last one don't show the time
The last entry shows the time, but no year
Output is different compared to SFTP

FTPS:
$options:=New object
$options.URL:="ftp://ftp.server.de/subDir/"
$options.USE_SSL:="USESSL_TRY" //Implicit FTPS
$options.USERNAME:=$user
$options.PASSWORD:=$pw
$status:=cURL_FTP_GetDirList($options; "")

$status.status yields 0 -> OK
$status.dirList contains:
drwxrwxrwx folder 0 Feb 11 2020 de.lproj
drwxrwxrwx folder 0 Feb 11 2020 ftp_test
-rw-rw-rw- 0 584975 584975 Jun 8 2020 ocr-0.2.zip
drwxrwxrwx folder 0 Jun 8 2020 ordner1
drwxrwxrwx folder 0 Feb 15 2020 ordner2
drwxrwxrwx folder 0 Jul 9 16:43 privat2

All entries except the last one don't show the time
The last entry shows the time, but no year
Output is different compared to SFTP

SFTP:
$options:=New object
$options.URL:="sftp://ftp.server.de/subDir/"
$options.USERNAME:=$user
$options.PASSWORD:=$pw
$status:=cURL_FTP_GetDirList($options; "")

$status.status yields 0 -> OK
$status.dirList contains:
drwxrwxrwx 1 rumpus staff 0 Feb 11 09:16 de.lproj
drwxrwxrwx 1 rumpus staff 0 Feb 11 10:45 ftp_test
-rw-rw-rw- 1 rumpus staff 584975 Jun 8 13:35 ocr-0.2.zip
drwxrwxrwx 1 rumpus staff 0 Jun 8 13:37 ordner1
drwxrwxrwx 1 rumpus staff 0 Feb 15 19:54 ordner2
drwxrwxrwx 1 rumpus staff 0 Jul 9 2021 privat2

All entries except the last one don't show the year
The last entry shows the year, but no time
All entries show user and group?! Output is different compared to FTP and FTPS. Formatting is different too

Windows:
FTP:
$options:=New object
$options.URL:="ftp://ftp.server.de/subDir/"
$options.USERNAME:=$user
$options.PASSWORD:=$pw
$status:=cURL_FTP_GetDirList($options; "")

-> Crash of 4D

FTPS:
$options:=New object
$options.URL:="ftp://ftp.server.de/subDir/"
$options.USE_SSL:="USESSL_TRY" //Implicit FTPS
$options.USERNAME:=$user
$options.PASSWORD:=$pw
$status:=cURL_FTP_GetDirList($options; "")

-> Crash of 4D

SFTP:
$options:=New object
$options.URL:="sftp://ftp.server.de/subDir/"
$options.USERNAME:=$user
$options.PASSWORD:=$pw
$status:=cURL_FTP_GetDirList($options; "")

-> Crash of 4D

Regards, Jörg

All tests were performed with v18R6 build 264867 on either macOS 10.14.6 or Windows 10 10.0.19043 (21H1).

SFTP: -> Crash of 4D
I do not reproduce a crash with

$options:=New object
$options.URL:="sftp://test.rebex.net"
$options.USERNAME:= "demo"
$options.PASSWORD:="password"
$status:=cURL_FTP_GetDirList ($options;"")

FTPS: -> Crash of 4D
I do not reproduce a crash with

$options:=New object
$options.URL:="ftps://test.rebex.net"
$options.USERNAME:= "demo"
$options.PASSWORD:="password"
$status:=cURL_FTP_GetDirList ($options;"")

need to test again on Windows.

All entries except the last one don't show the time
The last entry shows the time, but no year
Output is different compared to SFTP

the response format is specific to the server.

about GetDirList

  • the command LIST is sent to the server

could send NLST but the response is also server specific.

https://stackoverflow.com/questions/4564603/format-of-the-data-returned-by-the-ftp-list-command

there are more than 400 known formats for LIST.

MLST or LMSD might produce a more uniform response.

tested on Windows:

sftp: OK
ftp: OK
ftps: status 60
ftp+USE_SSL: OK