Another curl version-dependent feature thing
Seriously, who thought doubles were a good idea?
This commit is contained in:
parent
bd7aa33286
commit
e07b133e5a
@ -6,12 +6,14 @@
|
||||
#include "common/tpt-thread.h"
|
||||
#include <curl/curl.h>
|
||||
#include "common/String.h"
|
||||
#undef GetUserName // pthreads (included by curl) defines this, breaks stuff
|
||||
#undef GetUserName // pthreads defines this, breaks stuff
|
||||
|
||||
#ifdef CURL_AT_LEAST_VERSION
|
||||
# if CURL_AT_LEAST_VERSION(7, 56, 0)
|
||||
# define REQUEST_USE_CURL_MIMEPOST
|
||||
# endif
|
||||
#if defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7, 55, 0)
|
||||
# define REQUEST_USE_CURL_OFFSET_T
|
||||
#endif
|
||||
|
||||
#if defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7, 56, 0)
|
||||
# define REQUEST_USE_CURL_MIMEPOST
|
||||
#endif
|
||||
|
||||
namespace http
|
||||
|
@ -173,8 +173,16 @@ namespace http
|
||||
{
|
||||
if (multi && request->easy)
|
||||
{
|
||||
#ifdef REQUEST_USE_CURL_OFFSET_T
|
||||
curl_easy_getinfo(request->easy, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &request->rm_total);
|
||||
curl_easy_getinfo(request->easy, CURLINFO_SIZE_DOWNLOAD_T, &request->rm_done);
|
||||
#else
|
||||
double total, done;
|
||||
curl_easy_getinfo(request->easy, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &total);
|
||||
curl_easy_getinfo(request->easy, CURLINFO_SIZE_DOWNLOAD, &done);
|
||||
request->rm_total = (curl_off_t)total;
|
||||
request->rm_done = (curl_off_t)done;
|
||||
#endif
|
||||
}
|
||||
if (request->status)
|
||||
{
|
||||
|
Reference in New Issue
Block a user