CURLOPT: bump CURLPROXY_* enums to long, drop casts

This patch bumps the size of these macros from `int` to `long`, while
keeping their actual values the same. It may cause incompatibilities in
user code, requiring the bump of holder variables and/or adding casts:

- CURLPROXY_HTTP
- CURLPROXY_HTTP_1_0
- CURLPROXY_HTTPS
- CURLPROXY_HTTPS2
- CURLPROXY_SOCKS4
- CURLPROXY_SOCKS4A
- CURLPROXY_SOCKS5
- CURLPROXY_SOCKS5_HOSTNAME

Also:
- keep existing cast within the documentation to make sure it applies
  to older curl versions as well.

Closes #18054
This commit is contained in:
Viktor Szakats 2025-07-28 10:59:48 +02:00
parent d45b85d791
commit 1a12663d06
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
10 changed files with 28 additions and 25 deletions

View file

@ -791,7 +791,7 @@ static CURLcode setopt_long(struct Curl_easy *data, CURLoption option,
*/
if((arg < CURLPROXY_HTTP) || (arg > CURLPROXY_SOCKS5_HOSTNAME))
return CURLE_BAD_FUNCTION_ARGUMENT;
data->set.proxytype = (unsigned char)(curl_proxytype)arg;
data->set.proxytype = (unsigned char)arg;
break;
case CURLOPT_PROXY_TRANSFER_MODE:

View file

@ -2250,7 +2250,7 @@ static char *detect_proxy(struct Curl_easy *data,
*/
static CURLcode parse_proxy(struct Curl_easy *data,
struct connectdata *conn, char *proxy,
curl_proxytype proxytype)
long proxytype)
{
char *portptr = NULL;
int port = -1;
@ -2568,7 +2568,7 @@ static CURLcode create_conn_helper_init_proxy(struct Curl_easy *data,
* connection that may exist registered to the same proxy host.
***********************************************************************/
if(proxy || socksproxy) {
curl_proxytype ptype = (curl_proxytype)conn->http_proxy.proxytype;
long ptype = conn->http_proxy.proxytype;
if(proxy) {
result = parse_proxy(data, conn, proxy, ptype);
Curl_safefree(proxy); /* parse_proxy copies the proxy string */

View file

@ -625,8 +625,7 @@ struct ip_quadruple {
struct proxy_info {
struct hostname host;
int port;
unsigned char proxytype; /* curl_proxytype: what kind of proxy that is in
use */
unsigned char proxytype; /* what kind of proxy that is in use */
char *user; /* proxy username string, allocated */
char *passwd; /* proxy password string, allocated */
};
@ -1435,7 +1434,7 @@ struct UserDefined {
unsigned short proxyport; /* If non-zero, use this port number by
default. If the proxy string features a
":[port]" that one will override this. */
unsigned char proxytype; /* what kind of proxy: curl_proxytype */
unsigned char proxytype; /* what kind of proxy */
unsigned char socks5auth;/* kind of SOCKS5 authentication to use (bitmask) */
#endif
struct ssl_general_config general_ssl; /* general user defined SSL stuff */