lib/dload.c: remove assumption in continuation logic
Callers to curl_download_internal now tell us if its okay to continue a transfer, so obey this instead of using a heuristic. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
8807cac100
commit
0d1fcd329f
1 changed files with 3 additions and 5 deletions
|
@ -194,7 +194,7 @@ static int curl_download_internal(const char *url, const char *localpath,
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_FOLLOWLOCATION, 1L);
|
curl_easy_setopt(handle->curl, CURLOPT_FOLLOWLOCATION, 1L);
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_PROGRESSFUNCTION, curl_progress);
|
curl_easy_setopt(handle->curl, CURLOPT_PROGRESSFUNCTION, curl_progress);
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_PROGRESSDATA, (void *)&dlfile);
|
curl_easy_setopt(handle->curl, CURLOPT_PROGRESSDATA, (void *)&dlfile);
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_LOW_SPEED_LIMIT, 1200L);
|
curl_easy_setopt(handle->curl, CURLOPT_LOW_SPEED_LIMIT, 1024L);
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_LOW_SPEED_TIME, 10L);
|
curl_easy_setopt(handle->curl, CURLOPT_LOW_SPEED_TIME, 10L);
|
||||||
|
|
||||||
useragent = getenv("HTTP_USER_AGENT");
|
useragent = getenv("HTTP_USER_AGENT");
|
||||||
|
@ -202,10 +202,8 @@ static int curl_download_internal(const char *url, const char *localpath,
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_USERAGENT, useragent);
|
curl_easy_setopt(handle->curl, CURLOPT_USERAGENT, useragent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: no assuming here. the calling function should tell us what's kosher */
|
if(!allow_resume && !force && stat(destfile, &st) == 0) {
|
||||||
if(!force && stat(destfile, &st) == 0) {
|
/* start from scratch, but only download if our local is out of date. */
|
||||||
/* assume its a sync, so we're starting from scratch. but, only download
|
|
||||||
* our local is out of date. */
|
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
|
curl_easy_setopt(handle->curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
|
||||||
curl_easy_setopt(handle->curl, CURLOPT_TIMEVALUE, (long)st.st_mtime);
|
curl_easy_setopt(handle->curl, CURLOPT_TIMEVALUE, (long)st.st_mtime);
|
||||||
} else if(stat(tempfile, &st) == 0 && allow_resume) {
|
} else if(stat(tempfile, &st) == 0 && allow_resume) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue