Skip to content

Commit 018cbc4

Browse files
peffdscho
authored andcommitted
curl: fix symbolic constant typechecks with curl_easy_setopt()
As with the previous two commits, we should be passing long integers, not regular ones, to curl_easy_setopt(), and compiling against curl 8.14 loudly complains if we don't. This patch catches the remaining cases, which are ones where we pass curl's own symbolic constants. We'll cast them to long manually in each call. It seems kind of weird to me that curl doesn't define these constants as longs, since the point of them is to pass to curl_easy_setopt(). But in the curl documentation and examples, they clearly show casting them as part of the setopt calls. It may be that there is some reason not to push the type into the macro, like backwards compatibility. I didn't dig, as it doesn't really matter: we have to follow what existing curl versions ask for anyway. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b0095e9 commit 018cbc4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

http.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ static CURL *get_curl_handle(void)
11421142
}
11431143

11441144
curl_easy_setopt(result, CURLOPT_MAXREDIRS, 20L);
1145-
curl_easy_setopt(result, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL);
1145+
curl_easy_setopt(result, CURLOPT_POSTREDIR, (long)CURL_REDIR_POST_ALL);
11461146

11471147
#ifdef GIT_CURL_HAVE_CURLOPT_PROTOCOLS_STR
11481148
{
@@ -1217,18 +1217,18 @@ static CURL *get_curl_handle(void)
12171217

12181218
if (starts_with(curl_http_proxy, "socks5h"))
12191219
curl_easy_setopt(result,
1220-
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME);
1220+
CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS5_HOSTNAME);
12211221
else if (starts_with(curl_http_proxy, "socks5"))
12221222
curl_easy_setopt(result,
1223-
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
1223+
CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS5);
12241224
else if (starts_with(curl_http_proxy, "socks4a"))
12251225
curl_easy_setopt(result,
1226-
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4A);
1226+
CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS4A);
12271227
else if (starts_with(curl_http_proxy, "socks"))
12281228
curl_easy_setopt(result,
1229-
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
1229+
CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS4);
12301230
else if (starts_with(curl_http_proxy, "https")) {
1231-
curl_easy_setopt(result, CURLOPT_PROXYTYPE, CURLPROXY_HTTPS);
1231+
curl_easy_setopt(result, CURLOPT_PROXYTYPE, (long)CURLPROXY_HTTPS);
12321232

12331233
if (http_proxy_ssl_cert)
12341234
curl_easy_setopt(result, CURLOPT_PROXY_SSLCERT, http_proxy_ssl_cert);

0 commit comments

Comments
 (0)