diff --git a/wget-416-but-file-not-complete.patch b/wget-416-but-file-not-complete.patch index 6df7334..93c8c4b 100644 --- a/wget-416-but-file-not-complete.patch +++ b/wget-416-but-file-not-complete.patch @@ -2,15 +2,22 @@ Index: wget-1.19.1/src/http.c =================================================================== --- wget-1.19.1.orig/src/http.c +++ wget-1.19.1/src/http.c -@@ -3818,6 +3818,12 @@ gethttp (const struct url *u, struct url +@@ -3818,6 +3818,19 @@ gethttp (const struct url *u, struct url } } -+ // if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE) ++ fprintf(stderr, " hs->restval=%s\n", number_to_static_string(hs->restval)); ++ fprintf(stderr, " contlen=%s\n", number_to_static_string(contlen)); ++ fprintf(stderr, " contrange=%s\n", number_to_static_string(contrange)); ++ if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE ++ && hs->restval < (contlen + contrange)) + { -+ fprintf (stderr, "hs->restval=%s\n", number_to_static_string(hs->restval)); -+ fprintf (stderr, "contrange=%s\n", number_to_static_string(contrange)); -+ fprintf (stderr, "contlen=%s\n\n", number_to_static_string(contlen)); ++ /* The file was not completely downloaded, ++ yet the server claims the range is invalid. ++ Bail out. */ ++ CLOSE_INVALIDATE (sock); ++ retval = RANGEERR; ++ goto cleanup; + } if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE || (!opt.timestamping && hs->restval > 0 && statcode == HTTP_STATUS_OK