CURLINFO_USED_PROXY: return bool whether the proxy was used

Adds test536 to verify

Closes #12719
This commit is contained in:
Daniel Stenberg 2024-02-22 08:38:53 +01:00
parent d5b0fee39a
commit cc04c73677
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
12 changed files with 259 additions and 4 deletions

View file

@ -158,6 +158,13 @@ void Curl_persistconninfo(struct Curl_easy *data, struct connectdata *conn,
data->info.conn_primary_port = conn->port;
data->info.conn_remote_port = conn->remote_port;
data->info.conn_local_port = local_port;
data->info.used_proxy =
#ifdef CURL_DISABLE_PROXY
0
#else
conn->bits.proxy
#endif
;
}
static const struct Curl_addrinfo *

View file

@ -180,7 +180,6 @@ static CURLcode getinfo_char(struct Curl_easy *data, CURLINFO info,
*param_charp = NULL;
#endif
break;
default:
return CURLE_UNKNOWN_OPTION;
}
@ -334,6 +333,15 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
case CURLINFO_PROTOCOL:
*param_longp = data->info.conn_protocol;
break;
case CURLINFO_USED_PROXY:
*param_longp =
#ifdef CURL_DISABLE_PROXY
0
#else
data->info.used_proxy
#endif
;
break;
default:
return CURLE_UNKNOWN_OPTION;
}

View file

@ -1167,6 +1167,7 @@ struct PureInfo {
CURLproxycode pxcode;
BIT(timecond); /* set to TRUE if the time condition didn't match, which
thus made the document NOT get fetched */
BIT(used_proxy); /* the transfer used a proxy */
};