On Sat, 30 Jul 2016 21:33:19 +0200
Matthew White <[email protected]> wrote:

> 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]>

Hi,

I changed the patch description as Tim suggested. So, scratch the previous 
patch and use this one instead.

Later.

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

* src/metalink.c (retrieve_from_metalink): Continue file download if
  opt.always_rest is true

Without --continue, download as a new file with an unique name (this
conforms to the old behaviour).
---
 src/metalink.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/metalink.c b/src/metalink.c
index 545b0cb..5d7e9b2 100644
--- a/src/metalink.c
+++ b/src/metalink.c
@@ -153,7 +153,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;
 
               /* Bug: utils.h (unique_create): cannot create a
-- 
2.7.3

Reply via email to