mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2024-11-20 11:49:17 +01:00
Drop support for libcurl < 7.32.0
This commit is contained in:
parent
037582d3b1
commit
112ad17e18
@ -90,7 +90,6 @@ class Downloader
|
||||
std::string getChangelogFromJSON(const Json::Value& json);
|
||||
void saveChangelog(const std::string& changelog, const std::string& filepath);
|
||||
|
||||
static int progressCallbackOld(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
|
||||
static int progressCallback(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow);
|
||||
static size_t writeMemoryCallback(char *ptr, size_t size, size_t nmemb, void *userp);
|
||||
static size_t writeData(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||
|
@ -65,18 +65,14 @@ int Downloader::init()
|
||||
curl_easy_setopt(curlhandle, CURLOPT_USERAGENT, config.sVersionString.c_str());
|
||||
curl_easy_setopt(curlhandle, CURLOPT_NOPROGRESS, 0);
|
||||
curl_easy_setopt(curlhandle, CURLOPT_CONNECTTIMEOUT, config.iTimeout);
|
||||
curl_easy_setopt(curlhandle, CURLOPT_PROGRESSDATA, this);
|
||||
curl_easy_setopt(curlhandle, CURLOPT_FAILONERROR, true);
|
||||
curl_easy_setopt(curlhandle, CURLOPT_SSL_VERIFYPEER, config.bVerifyPeer);
|
||||
curl_easy_setopt(curlhandle, CURLOPT_VERBOSE, config.bVerbose);
|
||||
curl_easy_setopt(curlhandle, CURLOPT_WRITEFUNCTION, Downloader::writeData);
|
||||
curl_easy_setopt(curlhandle, CURLOPT_READFUNCTION, Downloader::readData);
|
||||
curl_easy_setopt(curlhandle, CURLOPT_PROGRESSFUNCTION, Downloader::progressCallbackOld);
|
||||
curl_easy_setopt(curlhandle, CURLOPT_MAX_RECV_SPEED_LARGE, config.iDownloadRate);
|
||||
#if LIBCURL_VERSION_NUM >= 0x072000 // libcurl version >= 7.32.0
|
||||
curl_easy_setopt(curlhandle, CURLOPT_XFERINFOFUNCTION, Downloader::progressCallback);
|
||||
curl_easy_setopt(curlhandle, CURLOPT_XFERINFODATA, this);
|
||||
#endif // LIBCURL_VERSION_NUM
|
||||
curl_easy_setopt(curlhandle, CURLOPT_XFERINFOFUNCTION, Downloader::progressCallback);
|
||||
curl_easy_setopt(curlhandle, CURLOPT_XFERINFODATA, this);
|
||||
|
||||
// Assume that we have connection error and abort transfer with CURLE_OPERATION_TIMEDOUT if download speed is less than 200 B/s for 30 seconds
|
||||
curl_easy_setopt(curlhandle, CURLOPT_LOW_SPEED_TIME, 30);
|
||||
@ -1873,15 +1869,6 @@ std::string Downloader::getResponse(const std::string& url)
|
||||
return response;
|
||||
}
|
||||
|
||||
int Downloader::progressCallbackOld(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
|
||||
{
|
||||
return Downloader::progressCallback(clientp,
|
||||
(curl_off_t)dltotal,
|
||||
(curl_off_t)dlnow,
|
||||
(curl_off_t)ultotal,
|
||||
(curl_off_t)ulnow);
|
||||
}
|
||||
|
||||
int Downloader::progressCallback(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
|
||||
{
|
||||
// on entry: dltotal - how much remains to download till the end of the file (bytes)
|
||||
|
Loading…
Reference in New Issue
Block a user