http curl client favoured new progress api if supported.
suppress openssl warning with openssl 3.0
This commit is contained in:
parent
c63faf395f
commit
fcf7cf953f
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include <enet/enet.h>
|
#include <enet/enet.h>
|
||||||
|
|
||||||
|
#define OPENSSL_API_COMPAT 0x09800000L
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/rand.h>
|
#include <openssl/rand.h>
|
||||||
|
|
||||||
|
@ -163,8 +163,8 @@ namespace Online
|
|||||||
curl_easy_setopt(m_curl_session, CURLOPT_URL, m_url.c_str());
|
curl_easy_setopt(m_curl_session, CURLOPT_URL, m_url.c_str());
|
||||||
curl_easy_setopt(m_curl_session, CURLOPT_FOLLOWLOCATION, 1L);
|
curl_easy_setopt(m_curl_session, CURLOPT_FOLLOWLOCATION, 1L);
|
||||||
curl_easy_setopt(m_curl_session, CURLOPT_NOPROGRESS, 0);
|
curl_easy_setopt(m_curl_session, CURLOPT_NOPROGRESS, 0);
|
||||||
curl_easy_setopt(m_curl_session, CURLOPT_PROGRESSDATA, this);
|
curl_easy_setopt(m_curl_session, PROGRESSDATA, this);
|
||||||
curl_easy_setopt(m_curl_session, CURLOPT_PROGRESSFUNCTION,
|
curl_easy_setopt(m_curl_session, PROGRESSFUNCTION,
|
||||||
&HTTPRequest::progressDownload);
|
&HTTPRequest::progressDownload);
|
||||||
curl_easy_setopt(m_curl_session, CURLOPT_CONNECTTIMEOUT, 20);
|
curl_easy_setopt(m_curl_session, CURLOPT_CONNECTTIMEOUT, 20);
|
||||||
curl_easy_setopt(m_curl_session, CURLOPT_LOW_SPEED_LIMIT, 10);
|
curl_easy_setopt(m_curl_session, CURLOPT_LOW_SPEED_LIMIT, 10);
|
||||||
@ -352,8 +352,8 @@ namespace Online
|
|||||||
* \param upload_now How muc has been uploaded so far.
|
* \param upload_now How muc has been uploaded so far.
|
||||||
*/
|
*/
|
||||||
int HTTPRequest::progressDownload(void *clientp,
|
int HTTPRequest::progressDownload(void *clientp,
|
||||||
double download_total, double download_now,
|
progress_t download_total, progress_t download_now,
|
||||||
double upload_total, double upload_now)
|
progress_t upload_total, progress_t upload_now)
|
||||||
{
|
{
|
||||||
HTTPRequest *request = (HTTPRequest *)clientp;
|
HTTPRequest *request = (HTTPRequest *)clientp;
|
||||||
|
|
||||||
|
@ -31,6 +31,16 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#if defined(CURLOPT_XFERINFODATA)
|
||||||
|
#define PROGRESSDATA CURLOPT_XFERINFODATA
|
||||||
|
#define PROGRESSFUNCTION CURLOPT_XFERINFOFUNCTION
|
||||||
|
typedef curl_off_t progress_t;
|
||||||
|
#else
|
||||||
|
#define PROGRESSDATA CURLOPT_PROGRESSDATA
|
||||||
|
#define PROGRESSFUNCTION CURLOPT_PROGRESSFUNCTION
|
||||||
|
typedef double progress_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Online
|
namespace Online
|
||||||
{
|
{
|
||||||
class API
|
class API
|
||||||
@ -84,9 +94,9 @@ namespace Online
|
|||||||
virtual void operation() OVERRIDE;
|
virtual void operation() OVERRIDE;
|
||||||
virtual void afterOperation() OVERRIDE;
|
virtual void afterOperation() OVERRIDE;
|
||||||
|
|
||||||
static int progressDownload(void *clientp, double dltotal,
|
static int progressDownload(void *clientp, progress_t dltotal,
|
||||||
double dlnow, double ultotal,
|
progress_t dlnow, progress_t ultotal,
|
||||||
double ulnow);
|
progress_t ulnow);
|
||||||
|
|
||||||
static size_t writeCallback(void *contents, size_t size,
|
static size_t writeCallback(void *contents, size_t size,
|
||||||
size_t nmemb, void *userp);
|
size_t nmemb, void *userp);
|
||||||
|
Loading…
Reference in New Issue
Block a user