From a56d6c4d316551940982d622e9b0e3b0f1ad1863 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 2 Apr 2012 21:47:13 +0300 Subject: Add curl version check. --- src/net/download.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/net/download.cpp') 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 +#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; } } -- cgit v1.2.3-70-g09d2