curl-library
[PATCH] a new option WILDCARDMATCH (FTP only for now)
Date: Tue, 30 Mar 2010 01:51:29 +0200
Hi all!
I'd like to offer you first patch to testing and considering wildcard
enhancement of FTP implementation.
This enhancement was consulted some time ago in other topic. It is based
on http://curl.haxx.se/docs/todo.html#ftp_wildcard_download.
It is possible now to download (from FTP for now) many files using
shell-like wildcard pattern --> setting url once and calling the
curl_easy_perform() only once too. This pattern is part of CURLOPT_URL -
the last part of url path.
eg. ftp://example.tld/path/to/files/*.txt
Patch is adding some new CURLOPTs:
CURLOPT_WILDCARDMATCH
- to turn the wildcard downloading on
CURLOPT_STARTUNIT
- Wildcard, callback called before downloading of an individual file
started
-- called for directories too - without downloading any data
- user could use "Curl_fileinfo" about this file
- user knows, how many files remains to download
- there is parameter void *userptr corresponding to CURLOPT_WRITEDATA
pointer.
CURLOPT_ENDUNIT
- called after individual download finished
- there is void * pointer parameter corresponding to CURLOPT_WRITEDATA
pointer.
CURLOPT_FNMATCH
- to change callback that is responsible for deciding, if set pattern
corresponds with individual filename
See curl/curl.h for callbacks prototypes and test sources..
Some notes:
- Calling STARTUNIT callback for directories could be comfortable for
applications that wants to download recursive!
- User can discard manually files with pattern-corresponding filenames in
STARTUNIT callback returning non-zero value.
- There is some transefer.c changes in patch needed for this function.
- There is no man changes for now..
There is zip-file as a attachment, (testpack.zip) containing some *.c
files and Makefile, which can help you with testing this patch.
- in README are some descriptions of make targets
- use `./tester --help` or `./progress --help` if you want to specify some
test and see README
- do not use any make output parsers for tests..
Thank you very much for any feedback! I'd like to hear if there is any
problem in concept of downloading, if you see some needed changes, etc.
Pavel
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
- application/octet-stream attachment: 0001-a-new-option-WILDCARDMATCH-FTP-only-for-now.patch