From 8e182c09072b75d05c1dff89bd3337f08782a562 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 31 Mar 2014 01:45:57 +0300 Subject: Use all supported encoding while accesing http. --- src/gui/windows/whoisonline.cpp | 1 + src/net/download.cpp | 8 ++++++++ src/net/download.h | 2 ++ 3 files changed, 11 insertions(+) diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index a1683ffc8..b7616eb72 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -519,6 +519,7 @@ int WhoIsOnline::downloadThread(void *ptr) curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 7); curl_easy_setopt(curl, CURLOPT_TIMEOUT, 30); + Net::Download::addHeaders(curl); Net::Download::addProxy(curl); Net::Download::secureCurl(curl); diff --git a/src/net/download.cpp b/src/net/download.cpp index 6d127d0a4..cf5a1d0b3 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -326,6 +326,7 @@ int Download::downloadThread(void *ptr) curl_easy_setopt(d->mCurl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(d->mCurl, CURLOPT_CONNECTTIMEOUT, 30); curl_easy_setopt(d->mCurl, CURLOPT_TIMEOUT, 1800); + addHeaders(d->mCurl); addProxy(d->mCurl); secureCurl(d->mCurl); } @@ -536,6 +537,13 @@ void Download::secureCurl(CURL *const curl) #endif } +void Download::addHeaders(CURL *const curl) +{ +#if CURLVERSION_ATLEAST(7, 21, 7) + curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, ""); +#endif +} + void Download::prepareForm(curl_httppost **form, const std::string &fileName) { curl_httppost *lastPtr = nullptr; diff --git a/src/net/download.h b/src/net/download.h index 7dae8913f..3628a8f3a 100644 --- a/src/net/download.h +++ b/src/net/download.h @@ -104,6 +104,8 @@ class Download final static void secureCurl(CURL *const curl); + static void addHeaders(CURL *const curl); + static unsigned long adlerBuffer(char *const buffer, int size); static std::string getUploadResponse() -- cgit v1.2.3-70-g09d2