From ad002369dfe4bca443fbe9fd3ef96967b1c02f97 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Sat, 7 Nov 2009 17:55:52 +0100 Subject: added curl version checks for compatibility with older versions --- README | 2 +- plugins/vfs_curl/vfs_curl.c | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/README b/README index 0869862d..8489fea4 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ dependencies for player core - includes support for sid, tracker music and chipt optional dependencies libvorbis: for ogg vorbis plugin - libcurl: for last.fm plugin + libcurl >= 7.10: for last.fm plugin libmad: for mpgmad plugin (mpeg1,2 layers1,2,3) libFLAC: for flac plugin wavpack: for wavpack plugin diff --git a/plugins/vfs_curl/vfs_curl.c b/plugins/vfs_curl/vfs_curl.c index 4a9324b1..3619ab6e 100644 --- a/plugins/vfs_curl/vfs_curl.c +++ b/plugins/vfs_curl/vfs_curl.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "../../deadbeef.h" //#define trace(...) { fprintf(stderr, __VA_ARGS__); } @@ -352,26 +353,30 @@ http_thread_func (uintptr_t ctx) { curl_easy_setopt (curl, CURLOPT_PROXYPORT, deadbeef->conf_get_int ("network.proxy.port", 8080)); const char *type = deadbeef->conf_get_str ("network.proxy.type", "HTTP"); int curlproxytype = CURLPROXY_HTTP; -// this is default -// if (!strcasecmp (type, "HTTP")) { -// curlproxytype = CURLPROXY_HTTP; -// } -// else - if (!strcasecmp (type, "HTTP_1_0")) { + if (!strcasecmp (type, "HTTP")) { + curlproxytype = CURLPROXY_HTTP; + } +#if LIBCURL_VERSION_MINOR >= 19 && LIBCURL_VERSION_PATCH >= 4 + else if (!strcasecmp (type, "HTTP_1_0")) { curlproxytype = CURLPROXY_HTTP_1_0; } +#endif +#if LIBCURL_VERSION_MINOR >= 15 && LIBCURL_VERSION_PATCH >= 2 else if (!strcasecmp (type, "SOCKS4")) { curlproxytype = CURLPROXY_SOCKS4; } +#endif else if (!strcasecmp (type, "SOCKS5")) { curlproxytype = CURLPROXY_SOCKS5; } +#if LIBCURL_VERSION_MINOR >= 18 && LIBCURL_VERSION_PATCH >= 0 else if (!strcasecmp (type, "SOCKS4A")) { curlproxytype = CURLPROXY_SOCKS4A; } else if (!strcasecmp (type, "SOCKS5_HOSTNAME")) { curlproxytype = CURLPROXY_SOCKS5_HOSTNAME; } +#endif curl_easy_setopt (curl, CURLOPT_PROXYTYPE, curlproxytype); } deadbeef->mutex_lock (fp->mutex); -- cgit v1.2.3