mirror of
https://github.com/mirror/wget.git
synced 2025-03-25 01:00:13 +08:00
Bail out on unexpected 416 server errors
* src/http.c (gethttp): Stop on 416 if file is incomplete
This commit is contained in:
parent
c451eec155
commit
6f3b995993
10
src/http.c
10
src/http.c
@ -3930,6 +3930,16 @@ gethttp (const struct url *u, struct url *original_url, struct http_stat *hs,
|
||||
}
|
||||
}
|
||||
|
||||
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))
|
||||
|
Loading…
Reference in New Issue
Block a user