resume: consider a resume from [content-length] to be OK

Basically since servers often then don't respond well to this and
instead send the full contents and then libcurl would instead error out
with the assumption that the server doesn't support resume. As the data
is then already transfered, this is now considered fine.

Test case 1434 added to verify this. Test case 1042 slightly modified.

Reported-by: hugo
Bug: http://curl.haxx.se/bug/view.cgi?id=1443
This commit is contained in:
Daniel Stenberg
2014-10-30 14:54:59 +01:00
parent f0b4bc12f8
commit 9bc2582c31
4 changed files with 106 additions and 4 deletions

View File

@@ -547,6 +547,18 @@ static CURLcode readwrite_data(struct SessionHandle *data,
if(data->state.resume_from && !k->content_range &&
(data->set.httpreq==HTTPREQ_GET) &&
!k->ignorebody) {
if(k->size == data->state.resume_from) {
/* The resume point is at the end of file, consider this fine
even if it doesn't allow resume from here. */
infof(data, "The entire document is already downloaded");
connclose(conn, "already downloaded");
/* Abort download */
k->keepon &= ~KEEP_RECV;
*done = TRUE;
return CURLE_OK;
}
/* we wanted to resume a download, although the server doesn't
* seem to support this and we did this with a GET (if it
* wasn't a GET we did a POST or PUT resume) */