From f296e55e50f3406f8f9a3e773079007a7348d7fc Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 9 Jan 2023 19:30:23 -0800 Subject: [PATCH] d_netfil: use CURLOPT_PROTOCOLS_STR if libcurl >= 7.85.0 (2022-08-31) --- src/d_netfil.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/d_netfil.c b/src/d_netfil.c index 32a328dc8..a56eab9d1 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -60,6 +60,14 @@ #include +#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); @@ -1716,7 +1724,7 @@ 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, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS); + curl_easy_setopt(http_handle, PROTOCOLS_CURLOPT, CURLPROTO_HTTP|CURLPROTO_HTTPS); curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("SRB2Kart/v%d.%d", VERSION, SUBVERSION)); // Set user agent as some servers won't accept invalid user agents.