curl: Made --metalink option toggle Metalink functionality
In this change, --metalink option no longer takes argument. If it is specified, given URIs are processed as Metalink XML file. If given URIs are remote (e.g., http URI), curl downloads it first. Regardless URI is local file (e.g., file URI scheme) or remote, Metalink XML file is not written to local file system and the received data is fed into Metalink XML parser directly. This means with --metalink option, filename related options like -O and -o are ignored. Usage examples: $ curl --metalink http://example.org/foo.metalink This will download foo.metalink and parse it and then download the URI described there. $ curl --metalink file://foo.metalink This will parse local file foo.metalink and then download the URI described there.
This commit is contained in:
committed by
Yang Tse
parent
424bb35877
commit
196c8242ca
@@ -171,7 +171,7 @@ static const struct LongShort aliases[]= {
|
||||
{"$G", "delegation", TRUE},
|
||||
{"$H", "mail-auth", TRUE},
|
||||
{"$I", "post303", FALSE},
|
||||
{"$J", "metalink", TRUE},
|
||||
{"$J", "metalink", FALSE},
|
||||
{"0", "http1.0", FALSE},
|
||||
{"1", "tlsv1", FALSE},
|
||||
{"2", "sslv2", FALSE},
|
||||
@@ -824,11 +824,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
case 'J': /* --metalink */
|
||||
{
|
||||
#ifdef USE_METALINK
|
||||
if(parse_metalink(config, nextarg) == -1) {
|
||||
warnf(config, "Could not parse Metalink file: %s\n", nextarg);
|
||||
/* TODO Is PARAM_BAD_USE appropriate here? */
|
||||
return PARAM_BAD_USE;
|
||||
}
|
||||
config->use_metalink = toggle;
|
||||
#else
|
||||
warnf(config, "--metalink option is ignored because the binary is "
|
||||
"built without the Metalink support.\n");
|
||||
|
||||
Reference in New Issue
Block a user