From: Daniel Stenberg Date: Fri, 28 Jan 2022 15:52:24 +0000 (+0100) Subject: urldata: CONN_IS_PROXIED replaces bits.close when proxy can be disabled X-Git-Tag: curl-7_82_0~162 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=91e3996aa70c4f40992cfa35b0cb0d7ceef53235;p=thirdparty%2Fcurl.git urldata: CONN_IS_PROXIED replaces bits.close when proxy can be disabled To remove run-time checks for such builds. Closes #8350 --- diff --git a/lib/doh.c b/lib/doh.c index d6a2167701..8e1fc9e230 100644 --- a/lib/doh.c +++ b/lib/doh.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2018 - 2021, Daniel Stenberg, , et al. + * Copyright (C) 2018 - 2022, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -911,7 +911,7 @@ CURLcode Curl_doh_is_resolved(struct Curl_easy *data, if(!dohp->probe[DOH_PROBE_SLOT_IPADDR_V4].easy && !dohp->probe[DOH_PROBE_SLOT_IPADDR_V6].easy) { failf(data, "Could not DoH-resolve: %s", data->state.async.hostname); - return data->conn->bits.proxy?CURLE_COULDNT_RESOLVE_PROXY: + return CONN_IS_PROXIED(data->conn)?CURLE_COULDNT_RESOLVE_PROXY: CURLE_COULDNT_RESOLVE_HOST; } else if(!dohp->pending) { diff --git a/lib/url.c b/lib/url.c index a80d605a5e..c402b19572 100644 --- a/lib/url.c +++ b/lib/url.c @@ -3390,7 +3390,7 @@ static CURLcode resolve_server(struct Curl_easy *data, else #endif - if(!conn->bits.proxy) { + if(!CONN_IS_PROXIED(conn)) { struct hostname *connhost; if(conn->bits.conn_to_host) connhost = &conn->conn_to_host; diff --git a/lib/urldata.h b/lib/urldata.h index cc9c888709..b282cedd8a 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2022, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -450,6 +450,11 @@ struct negotiatedata { }; #endif +#ifdef CURL_DISABLE_PROXY +#define CONN_IS_PROXIED(x) 0 +#else +#define CONN_IS_PROXIED(x) x->bits.proxy +#endif /* * Boolean values that concerns this connection. @@ -470,6 +475,7 @@ struct ConnectBits { BIT(proxy_connect_closed); /* TRUE if a proxy disconnected the connection in a CONNECT request with auth, so that libcurl should reconnect and continue. */ + BIT(proxy); /* if set, this transfer is done through a proxy - any type */ #endif /* always modify bits.close with the connclose() and connkeep() macros! */ BIT(close); /* if set, we close the connection after this request */ @@ -479,7 +485,6 @@ struct ConnectBits { that overrides the host in the URL */ BIT(conn_to_port); /* if set, this connection has a "connect to port" that overrides the port in the URL (remote port) */ - BIT(proxy); /* if set, this transfer is done through a proxy - any type */ BIT(user_passwd); /* do we use user+password for this connection? */ BIT(ipv6_ip); /* we communicate with a remote site specified with pure IPv6 IP address */