diff options
author | Daniel Stenberg <daniel@haxx.se> | 2021-03-16 14:41:06 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-03-17 08:26:46 +0100 |
commit | 6d176bee59558a1ec9dffc6633aa05e713af73f0 (patch) | |
tree | a9004cd4a0edd3ddc71967bdfb9e56051f091a2f /lib/http.c | |
parent | e8e7ef3612d28e98b7b072f8d48c2a9f0b4662b5 (diff) | |
download | curl-6d176bee59558a1ec9dffc6633aa05e713af73f0.tar.gz |
http: make 416 not fail with resume + CURLOPT_FAILONERRROR
When asked to resume a download, libcurl will convert that to HTTP logic
and if then the entire file is already transferred it will result in a
416 response from the HTTP server. With CURLOPT_FAILONERRROR set in that
scenario, it should *not* lead to an error return.
Updated test 1156, added test 1273
Reported-by: Jonathan Watt
Fixes #6740
Closes #6753
Diffstat (limited to 'lib/http.c')
-rw-r--r-- | lib/http.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/http.c b/lib/http.c index 43eb840de..7ec03e9bd 100644 --- a/lib/http.c +++ b/lib/http.c @@ -1095,6 +1095,14 @@ static bool http_should_fail(struct Curl_easy *data) return FALSE; /* + ** A 416 response to a resume request is presumably because the file is + ** already completely downloaded and thus not actually a fail. + */ + if(data->state.resume_from && data->state.httpreq == HTTPREQ_GET && + httpcode == 416) + return FALSE; + + /* ** Any code >= 400 that's not 401 or 407 is always ** a terminal error */ |