summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-02 21:47:13 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-02 21:47:13 +0300
commita56d6c4d316551940982d622e9b0e3b0f1ad1863 (patch)
treea77f7636e58fe55bcd1115e0eca891a9e013868d /src
parent88ff6f74fa5b5103e6391d320b938838752fc6c4 (diff)
downloadplus-a56d6c4d316551940982d622e9b0e3b0f1ad1863.tar.gz
plus-a56d6c4d316551940982d622e9b0e3b0f1ad1863.tar.bz2
plus-a56d6c4d316551940982d622e9b0e3b0f1ad1863.tar.xz
plus-a56d6c4d316551940982d622e9b0e3b0f1ad1863.zip
Add curl version check.
Diffstat (limited to 'src')
-rw-r--r--src/net/download.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/net/download.cpp b/src/net/download.cpp
index 4eec6b0b4..1acb4b59b 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -34,6 +34,11 @@
#include <zlib.h>
+#define CURLVERSION_ATLEAST(a, b, c) ((LIBCURL_VERSION_MAJOR > (a)) || \
+ ((LIBCURL_VERSION_MAJOR == (a)) && (LIBCURL_VERSION_MINOR > (b))) || \
+ ((LIBCURL_VERSION_MAJOR == (a)) && (LIBCURL_VERSION_MINOR == (b)) && \
+ (LIBCURL_VERSION_PATCH >= (c))))
+
#include "debug.h"
const char *DOWNLOAD_ERROR_MESSAGE_THREAD
@@ -381,20 +386,28 @@ void Download::addProxy(CURL *curl)
case 2: // HTTP
break;
case 3: // HTTP 1.0
+#if CURLVERSION_ATLEAST(7, 19, 4)
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP_1_0);
+#endif
break;
case 4: // SOCKS4
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
break;
case 5: // SOCKS4A
+#if CURLVERSION_ATLEAST(7, 18, 0)
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4A);
+#else
+ curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
+#endif
break;
case 6: // SOCKS5
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
break;
case 7: // SOCKS5 hostname
+#if CURLVERSION_ATLEAST(7, 18, 0)
curl_easy_setopt(curl, CURLOPT_PROXYTYPE,
CURLPROXY_SOCKS5_HOSTNAME);
+#endif
break;
}
}