proxy-auth: additional tests

Also eliminate the special handling for socks proxy match.

Closes #20837
This commit is contained in:
Stefan Eissing 2026-03-06 14:54:09 +01:00 committed by Daniel Stenberg
parent e47b6e657a
commit 5f13a7645e
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 42 additions and 24 deletions

View file

@ -590,29 +590,15 @@ static bool proxy_info_matches(const struct proxy_info *data,
{
if((data->proxytype == needle->proxytype) &&
(data->port == needle->port) &&
curl_strequal(data->host.name, needle->host.name))
curl_strequal(data->host.name, needle->host.name)) {
if(Curl_timestrcmp(data->user, needle->user) ||
Curl_timestrcmp(data->passwd, needle->passwd))
return FALSE;
return TRUE;
}
return FALSE;
}
static bool socks_proxy_info_matches(const struct proxy_info *data,
const struct proxy_info *needle)
{
if(!proxy_info_matches(data, needle))
return FALSE;
/* the user information is case-sensitive
or at least it is not defined as case-insensitive
see https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1 */
/* curl_strequal does a case insensitive comparison,
so do not use it here! */
if(Curl_timestrcmp(data->user, needle->user) ||
Curl_timestrcmp(data->passwd, needle->passwd))
return FALSE;
return TRUE;
}
#endif
/* A connection has to have been idle for less than 'conn_max_idle_ms'
@ -923,7 +909,7 @@ static bool url_match_proxy_use(struct connectdata *conn,
return FALSE;
if(m->needle->bits.socksproxy &&
!socks_proxy_info_matches(&m->needle->socks_proxy, &conn->socks_proxy))
!proxy_info_matches(&m->needle->socks_proxy, &conn->socks_proxy))
return FALSE;
if(m->needle->bits.httpproxy) {