Hello!

It seems that wget ignores the option --continue in conjunction with the option 
--input-metalink.

This patch enables wget to continue partially downloaded Metalink's files.

I made this patch working on the following branch:
master (latest 20cac2c5ab3d63aacfba35fb10878a2d490e2377)
git://git.savannah.gnu.org/wget.git

Was there a reason to not continue Metalink's files?

-- 
Matthew White <[email protected]>
>From bd5f3a2622ea93f577375efbb3ec174728cddf5c Mon Sep 17 00:00:00 2001
From: Matthew White <[email protected]>
Date: Thu, 28 Jul 2016 17:36:51 +0200
Subject: [PATCH] With --continue, continue partially downloaded Metalink's
 files

Without --continue, a new file with an unique name is created (this
conforms to the old behaviour).

* src/metalink.c: Continue download when opt.always_rest is true
---
 src/metalink.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/metalink.c b/src/metalink.c
index 623f32d..f21f3aa 100644
--- a/src/metalink.c
+++ b/src/metalink.c
@@ -151,7 +151,13 @@ retrieve_from_metalink (const metalink_t* metalink)
                  To do that we create the local file here and put
                  it as output_stream. We restore the original configuration
                  after we are finished with the file.  */
-              output_stream = unique_create (mfile->name, true, &filename);
+              if (opt.always_rest)
+                // continue previous download
+                output_stream = fopen (mfile->name, "ab");
+              else
+                // create a file with an unique name
+                output_stream = unique_create (mfile->name, true, &filename);
+
               output_stream_regular = true;
 
               /* When filename is set, wget behaves as if the option
-- 
2.7.3

Reply via email to