mirror of
https://github.com/curl/curl.git
synced 2026-08-25 21:23:32 +03:00
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
This commit is contained in:
parent
2e65a92052
commit
09d16af49a
6 changed files with 262 additions and 14 deletions
23
lib/http.c
23
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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue