bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] Batch retrieval does not recover from extended pause


From: Ángel González
Subject: Re: [Bug-wget] Batch retrieval does not recover from extended pause
Date: Thu, 29 Mar 2012 23:02:04 +0200
User-agent: Thunderbird

Hello Pekka,
Thanks for your report.

gethttp() isn't the easiest function to follow, with its 1243 lines, but
I think
everything important is happening at the bottom. The file is created in
line 2855,
but not stored into output_stream (it's only used by -O). Then it's
failing at
read_response_body() and retries to open it in exclusive mode, instead of
continuing writing to it. I think the difference is made in line 2817,
where you
usually fopen (hs->local_file, "ab"); on retries, but as in this case it
timeouted
without reading anything, it goes through the fopen_excl() path.

I think this would fix it, although it's not clear at all that in such
case the file
was just created by us with 0-size. It probably deserves a comment.

=== modified file 'src/http.c'
--- src/http.c    2012-02-25 10:58:21 +0000
+++ src/http.c    2012-03-29 20:58:42 +0000
@@ -2827,7 +2827,7 @@
         }
       else if (ALLOW_CLOBBER || count > 0)
         {
-      if (opt.unlink && file_exists_p (hs->local_file))
+      if ((opt.unlink || count > 0) && file_exists_p (hs->local_file))
         {
           int res = unlink (hs->local_file);
           if (res < 0)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]