Merge branch 'fix-curl-protocols-str' into 'master'

d_netfil.c: fix usage of CURLOPT_PROTOCOLS_STR

See merge request KartKrew/Kart!887
This commit is contained in:
toaster 2023-01-12 16:12:54 +00:00
commit d5491612f2

View file

@ -56,14 +56,6 @@
#include <errno.h>
#ifdef HAVE_CURL
# if LIBCURL_VERSION_MAJOR >= 7 && LIBCURL_VERSION_MINOR >= 85
# define PROTOCOLS_CURLOPT CURLOPT_PROTOCOLS_STR
# else
# define PROTOCOLS_CURLOPT CURLOPT_PROTOCOLS // deprecated in 7.85.0
# endif
#endif
// Prototypes
static boolean AddFileToSendQueue(INT32 node, const char *filename, UINT8 fileid);
@ -1810,7 +1802,11 @@ void CURLPrepareFile(const char* url, int dfilenum)
curl_easy_setopt(http_handle, CURLOPT_URL, va("%s/%s", url, curl_realname));
// Only allow HTTP and HTTPS
curl_easy_setopt(http_handle, PROTOCOLS_CURLOPT, CURLPROTO_HTTP|CURLPROTO_HTTPS);
#if LIBCURL_VERSION_MAJOR > 7 || (LIBCURL_VERSION_MAJOR == 7 && LIBCURL_VERSION_MINOR >= 85)
curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS_STR, "http,https");
#else
curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS); // deprecated in 7.85.0
#endif
curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("Ring Racers/v%d.%d", VERSION, SUBVERSION)); // Set user agent as some servers won't accept invalid user agents.