curl-library
Using FTP's REST COMMAND in LIBCURL
Date: Thu, 14 Aug 2014 04:52:25 -0700
Hi
I am using LIBCURL to download a file, if the network connection gets broken then I have used FTP's REST comand (set in a PREQUOTE comand) to implement file resumption.
LIBCURL resumes file transfer from the specified location successfully but at the end, the CURLE_EASY_PERFORM returns the error code CURLE_PARTIAL_FILE instead of CURLE_OK.
I have intentionally used FTP REST command instead of LIBCURL's CURLOPT_RESUME_FROM option.
Have I missed any setting?
Here is my source code:
curl_easy_setopt(handles, CURLOPT_URL, remote_url);
curl_easy_setopt(handles, CURLOPT_WRITEDATA, downloadedData);
curl_easy_setopt(handles, CURLOPT_WRITEFUNCTION, downloadFn);
curl_easy_setopt(handles, CURLOPT_VERBOSE, 1L);
result = curl_easy_perform(handles);
if(result != CURLE_OK)
{
struct curl_slist *paction = NULL;
char cmd[256]={0};
//get file size from local temp file
sprintf(cmd,"REST %d", downloadedFileSize); // resume file download from the specified location in the file on the remote side.
paction = curl_slist_append(paction, cmd);
CURLcode rvq = curl_easy_setopt(handles, CURLOPT_PREQUOTE, paction);
result = curl_easy_perform(handles);
}
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-08-14