wget/wget-416-but-file-not-complete.patch

22 lines
762 B
Diff
Raw Normal View History

Index: wget-1.19.1/src/http.c
===================================================================
--- wget-1.19.1.orig/src/http.c
+++ wget-1.19.1/src/http.c
@@ -3819,6 +3819,16 @@ gethttp (const struct url *u, struct url
}
if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE
+ && hs->restval < (contlen + contrange))
+ {
+ /* 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
&& contrange == 0 && contlen >= 0 && hs->restval >= contlen))
{