aboutsummaryrefslogtreecommitdiff
path: root/lib/http.c
diff options
context:
space:
mode:
authorPatrick Monnerat <patrick@monnerat.net>2018-05-22 13:23:02 +0200
committerPatrick Monnerat <patrick@monnerat.net>2018-05-22 13:23:02 +0200
commit09d16af49a07af14dd635e23cdd6a0d287e54e54 (patch)
tree642192fa1da90f38d5e08654e4b9e802da31a1fc /lib/http.c
parent2e65a920523519440f3768967915f022fae9701f (diff)
downloadgnurl-09d16af49a07af14dd635e23cdd6a0d287e54e54.tar.gz
gnurl-09d16af49a07af14dd635e23cdd6a0d287e54e54.tar.bz2
gnurl-09d16af49a07af14dd635e23cdd6a0d287e54e54.zip
http resume: skip body if http code 416 (range error) is ignored.
This avoids appending error data to already existing good data. Test 92 is updated to match this change. New test 1156 checks all combinations of --range/--resume, --fail, Content-Range header and http status code 200/416. Fixes #1163 Reported-By: Ithubg on github Closes #2578
Diffstat (limited to 'lib/http.c')
-rw-r--r--lib/http.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/lib/http.c b/lib/http.c
index d4854013d..dac2b1417 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -3487,21 +3487,18 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data,
* depending on how authentication is working. Other codes
* are definitely errors, so give up here.
*/
- if(data->set.http_fail_on_error && (k->httpcode >= 400) &&
+ if(data->state.resume_from && data->set.httpreq == HTTPREQ_GET &&
+ k->httpcode == 416) {
+ /* "Requested Range Not Satisfiable", just proceed and
+ pretend this is no error */
+ k->ignorebody = TRUE; /* Avoid appending error msg to good data. */
+ }
+ else if(data->set.http_fail_on_error && (k->httpcode >= 400) &&
((k->httpcode != 401) || !conn->bits.user_passwd) &&
((k->httpcode != 407) || !conn->bits.proxy_user_passwd) ) {
-
- if(data->state.resume_from &&
- (data->set.httpreq == HTTPREQ_GET) &&
- (k->httpcode == 416)) {
- /* "Requested Range Not Satisfiable", just proceed and
- pretend this is no error */
- }
- else {
- /* serious error, go home! */
- print_http_error(data);
- return CURLE_HTTP_RETURNED_ERROR;
- }
+ /* serious error, go home! */
+ print_http_error(data);
+ return CURLE_HTTP_RETURNED_ERROR;
}
if(conn->httpversion == 10) {