Hi,
I use libcurl to call the dropbox api to achieve some functions.
When calling file/download, the download will be disconnected when the file exceeds 2G, so I want to implement the function of file continuation.
Locally use curl to send
curl -X POST <url> \
<rest code>
--header'Range: {"bytes": "xxx-"} '
to dropbox to achieve continuation;
But when using libcurl, it will not, and a curl 33 error (CURLE_RANGE_ERROR) will appear
Here's my C code(Code is omitted):
<curl init code>
FILE *fp = fopen(tmp_file,"a");
if(resume_flag)
wd_DEBUG("[DEBUG] add resume download header\n");
char *resume_dl = NULL;
resume_dl=(char *)malloc(strlen(filename) + 128);
memset(resume_dl,0,strlen(filename)+128);
snprintf(resume_dl, strlen(filename)+128, "Range: {\"bytes\": \"%lld-\"}", tmp_file_size);
headerlist=curl_slist_append(headerlist, resume_dl);
free(resume_dl);
}
curl_easy_setopt(curl,CURLOPT_WRITEDATA,fp);
res=curl_easy_perform(curl);
<rest code>
I also tried CURLOPT_RANGE, CURLOPT_RESUME_FROM and CURLOPT_RESUME_FROM_LARGE all the same problem, files always start downloading from 0.
I wonder if the dropbox api supports continued downloading of files, or if it's the code I wrote