Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=34f3cf66b43d4ee7d50e8328b13882762f27b845

commit 34f3cf66b43d4ee7d50e8328b13882762f27b845
Author: Marius Cirsta <[email protected]>
Date:   Sun Dec 1 03:09:02 2013 +0200

* when resuming fails download again from the beginning

diff --git a/lib/libpacman/server.c b/lib/libpacman/server.c
index bfc4794..545e93a 100644
--- a/lib/libpacman/server.c
+++ b/lib/libpacman/server.c
@@ -291,7 +291,15 @@ pmdownloadsuccess_t 
_pacman_curl_download(pmcurldownloader_t *curldownloader, co
pm_errno = PM_ERR_RETRIEVE;
goto error;
}
-       if(curl_easy_perform(curlHandle) != CURLE_OK) {
+       CURLcode retc = curl_easy_perform(curlHandle);
+       if(retc == CURLE_RANGE_ERROR || retc == CURLE_BAD_DOWNLOAD_RESUME) {
+         //server doesn't support ranges or we have an invalid range
+         curl_easy_setopt(curlHandle, CURLOPT_RESUME_FROM, 0);
+         fclose(outputFile);
+         outputFile = fopen(output,"wb");
+         retc = curl_easy_perform(curlHandle);
+       }
+       if(retc != CURLE_OK) {
_pacman_log(PM_LOG_WARNING, _("error downloading file: %s\n"), url);
pm_errno = PM_ERR_RETRIEVE;
goto error;
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to