cURL / Mailing Lists / curl-library / Single Mail


Re: [PATCH] a new option WILDCARDMATCH (FTP only for now)

From: Jamie Lokier <>
Date: Thu, 1 Apr 2010 11:34:31 +0100

Daniel Stenberg wrote:
> 14 - when a directory linsting line is parsed, how come it doesn't store
> timestamp, permission, user + group etc and provides that in the callback
> as well? I'm sure applications who want info about files would like that
> info too.

FTP directory parsing is a somewhat arcane art to do portably for all
FTP servers, especially when the FTP server isn't unix.

I think it's a really good idea to have it provided in curl if an
application wants it, and over time it might accumulate knowledge
needed for different flavours of directory listing. That knowledge is
easily searched for in the source of any number of FTP clients,
although I don't know anywhere that's gathered it all together

Permission, user + group is surely a very unix-centric thing?

Timestamp from directory listing is a bit iffy, because I gather FTP
servers flip between giving the day+month+hour+minute (no year) and
giving just the day+month+year (no time), according to distance from
the time of the request, and occasionally getting confused by
timezones in that decision (especially on Windows), and occasionally
getting confused if a file's timestamp is in the future.

Properly reading a symlink is a bit iffy if you have a symlink with
" -> " in it's name... But I guess that can be ignored :-)

> 19 - fnmatch() is not portable enough for unconditional use. Lots of
> systems that build and run libcurl have no native fnmatch(). You either
> need to provide an alternative "native" version for those systems or we
> need to have the entire matching code conditional on the existance of this
> function.

Or just leave that to the application? I.e. return each filename and
let the application decide which ones it wants. That's more flexible
than fnmatch and avoids portability of fnmatch issues. Even when you
have native fnmatch(), they don't all behave exactly the same.

-- Jamie
List admin:
Received on 2010-04-01