aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2014-10-30 14:54:59 +0100
committerDaniel Stenberg <daniel@haxx.se>2014-11-01 23:09:24 +0100
commit9bc2582c31d10b49f9070a99848e96951f6b66c5 (patch)
treeea3f48c25c7cc6389329778297bb7ad15d4afcf5 /lib
parentf0b4bc12f82869f1e95a480e52ea0adb6eb58971 (diff)
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
Diffstat (limited to 'lib')
-rw-r--r--lib/transfer.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index b5ba86eb4..6d4ad43fa 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -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) */