Skip to content

Commit f03664b

Browse files
marsamsteve-chavez
authored andcommitted
feat: use CURLOPT_PROTOCOLS_STR with libcurl >= 7.85.0
CURLOPT_PROTOCOLS was deprecated in libcurl 7.85.0, causing build error: src/worker.c: In function 'init': src/worker.c:153:9: error: 'CURLOPT_PROTOCOLS' is deprecated: since 7.85.0. Use CURLOPT_PROTOCOLS_STR [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wdeprecated-declarations-Werror=deprecated-declarations8;;] 153 | curl_easy_setopt(eh, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); | ^~~~~~~~~~~~~~~~ In file included from src/worker.c:30: /nix/store/3k4czsnh3wg9liji56v4kjdz3p1mxhsj-curl-8.6.0-dev/include/curl/curl.h:1745:3: note: declared here 1745 | CURLOPTDEPRECATED(CURLOPT_PROTOCOLS, CURLOPTTYPE_LONG, 181, | ^~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors
1 parent 681c8c8 commit f03664b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/worker.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,11 @@ static CURLMcode init(CURLM *cm, char *method, char *url, int timeout_millisecon
150150
curl_easy_setopt(eh, CURLOPT_FOLLOWLOCATION, true);
151151
if (log_min_messages <= DEBUG1)
152152
curl_easy_setopt(eh, CURLOPT_VERBOSE, 1L);
153+
#if LIBCURL_VERSION_NUM >= 0x075500 /* libcurl 7.85.0 */
154+
curl_easy_setopt(eh, CURLOPT_PROTOCOLS_STR, "http,https");
155+
#else
153156
curl_easy_setopt(eh, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
157+
#endif
154158
return curl_multi_add_handle(cm, eh);
155159
}
156160

0 commit comments

Comments
 (0)