From 6a6f849c5cc17d2bca090df995ace52cd694013a Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Fri, 5 Aug 2011 01:08:21 -0400 Subject: [PATCH] Return a file size string when possible. This takes the advice from http://files.stairways.com/other/ftp-list-specs-info.txt further: search for the date by an explicit occurrence of a known month name. This means that we won't see files with bad names (they'd be filtered out of the result), but the filtered out entries are ones that would not be usable with `ftp-make-file-seconds'. When the month is found, and the entry is a file, look for a number preceding the month, and if found, return it as the file size string. This is a minor change in the API. (But it's probably better to either revise it further, or eventually make it irrelevant by exposing the interesting functionality via `net/url'.) original commit: 6a1336e75edff75b7fc8a22a31d776acadc536eb --- collects/net/scribblings/ftp.scrbl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/collects/net/scribblings/ftp.scrbl b/collects/net/scribblings/ftp.scrbl index 9f76d73121..52901c51ac 100644 --- a/collects/net/scribblings/ftp.scrbl +++ b/collects/net/scribblings/ftp.scrbl @@ -46,13 +46,16 @@ Returns a list of files and directories in the current directory of the server, assuming that the server provides directory information in the quasi-standard Unix format. -Each file or directory is represented by a list of three strings. The -first string is either @racket["-"], @racket["d"], or @racket["l"], -depending on whether the items is a file, directory, or link, -respectively. The second item is the file's date; to convert this +Each file or directory is represented by a list of three or four +strings. The first string is either @racket["-"], @racket["d"], or +@racket["l"], depending on whether the items is a file, directory, or +link, respectively. The second item is the file's date; to convert this value to seconds consistent with @racket[file-seconds], pass the date -string to @racket[ftp-make-file-seconds], below. The third string is -the name of the file or directory. +string to @racket[ftp-make-file-seconds]. The third string is the name +of the file or directory. If the item is a file (the first string is +@racket["-"]), and if the line that the server replied with has a size +in the expected place, then a fourth string containing this size is +included. Warning: the FTP protocol has no specification for the reply format, so this information can be unreliable.}