mirror of
https://github.com/mirror/wget.git
synced 2025-03-14 20:00:15 +08:00
Update fallbacking for metalink: next source goes on from where the previous one failed.
This commit is contained in:
parent
38b1df95f9
commit
159c371492
@ -3021,6 +3021,10 @@ Spider mode enabled. Check if remote file exists.\n"));
|
||||
/* Time? */
|
||||
tms = datetime_str (time (NULL));
|
||||
|
||||
#ifdef ENABLE_METALINK
|
||||
range->bytes_covered = hstat.len;
|
||||
#endif
|
||||
|
||||
/* Get the new location (with or without the redirection). */
|
||||
if (hstat.newloc)
|
||||
*newloc = xstrdup (hstat.newloc);
|
||||
|
11
src/retr.c
11
src/retr.c
@ -1046,7 +1046,7 @@ retrieve_from_file (const char *file, bool html, int *count)
|
||||
{
|
||||
ranges[j].first_byte = j * chunk_size;
|
||||
ranges[j].last_byte = (j+1) * chunk_size - 1;
|
||||
ranges[j].is_covered = ranges[j].is_assigned = 0;
|
||||
ranges[j].bytes_covered = ranges[j].is_assigned = 0;
|
||||
ranges[j].resources = malloc(num_of_resources * sizeof(bool));
|
||||
for (r = 0; r < num_of_resources; ++r)
|
||||
ranges[j].resources[r] = false;
|
||||
@ -1106,10 +1106,7 @@ retrieve_from_file (const char *file, bool html, int *count)
|
||||
status = thread_ctx[r].status;
|
||||
/* Check return status of thread for errors. */
|
||||
if (status == RETROK)
|
||||
{
|
||||
(thread_ctx[r].range)->is_covered = 1;
|
||||
++ranges_covered;
|
||||
}
|
||||
else if (status == FOPENERR || status == WRITEFAILED || status == UNLINKERR ||
|
||||
status == FWRITEERR || status == FOPEN_EXCL_ERR)
|
||||
{
|
||||
@ -1135,6 +1132,12 @@ retrieve_from_file (const char *file, bool html, int *count)
|
||||
if (j < num_of_resources)
|
||||
{
|
||||
thread_ctx[r].url = file->resources[j]->url;
|
||||
if ((thread_ctx[r].range)->bytes_covered)
|
||||
{
|
||||
(thread_ctx[r].range)->first_byte =
|
||||
(thread_ctx[r].range)->bytes_covered;
|
||||
(thread_ctx[r].range)->bytes_covered = 0;
|
||||
}
|
||||
ret = spawn_thread (thread_ctx, file->name, r, j);
|
||||
if (ret)
|
||||
{
|
||||
|
@ -359,7 +359,7 @@ typedef enum
|
||||
struct range {
|
||||
int first_byte;
|
||||
int last_byte;
|
||||
int is_covered;
|
||||
int bytes_covered;
|
||||
int is_assigned;
|
||||
bool *resources;
|
||||
uerr_t status_least_severe;
|
||||
|
Loading…
Reference in New Issue
Block a user