summaryrefslogtreecommitdiff
path: root/src/tool_operate.c
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-04-26 22:59:52 +0900
committerDaniel Stenberg <daniel@haxx.se>2012-05-26 23:07:42 +0200
commitb5fdbe848bc3d088445817aa890d3f2f74ac5b02 (patch)
treec74203901cba4d4b9916fad127bdfe6778622ee6 /src/tool_operate.c
parentefb8471a69e0b5b9fe2296954b4917e294392372 (diff)
downloadcurl-b5fdbe848bc3d088445817aa890d3f2f74ac5b02.tar.gz
Support Metalink.
This change adds experimental Metalink support to curl. To enable Metalink support, run configure with --with-libmetalink. To feed Metalink file to curl, use --metalink option like this: $ curl -O --metalink foo.metalink We use libmetalink to parse Metalink files.
Diffstat (limited to 'src/tool_operate.c')
-rw-r--r--src/tool_operate.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 689ffb2d7..ffb37ff1b 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -388,6 +388,11 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
}
}
+#ifdef HAVE_LIBMETALINK
+ config->metalinkfile_last = config->metalinkfile_list;
+ config->metalink_last = config->metalink_list;
+#endif /* HAVE_LIBMETALINK */
+
/*
** Nested loops start here.
*/
@@ -439,6 +444,24 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
}
}
+ /* process metalink download in the separate function */
+ if(urlnode->flags & GETOUT_METALINK) {
+ struct OutStruct outs;
+ long retry_sleep_default;
+ struct getout *nextnode;
+
+ retry_sleep_default = (config->retry_delay) ?
+ config->retry_delay*1000L : RETRY_SLEEP_DEFAULT; /* ms */
+ /* default output stream is stdout */
+ memset(&outs, 0, sizeof(struct OutStruct));
+ outs.stream = stdout;
+ outs.config = config;
+ operatemetalink(curl, urlnode, retry_sleep_default, outs, heads,
+ outfiles, config);
+ /* move on to the next URL */
+ continue;
+ }
+
/* Here's the loop for uploading multiple files within the same
single globbed string. If no upload, we enter the loop once anyway. */
for(up = 0 ; up < infilenum; up++) {
@@ -1608,6 +1631,11 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
if(config->errors_fopened && config->errors)
fclose(config->errors);
+#ifdef HAVE_LIBMETALINK
+ /* Release metalink related resources here */
+ clean_metalink(config);
+#endif /* HAVE_LIBMETALINK */
+
main_free(); /* cleanup */
return res;