summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2023-01-03 14:58:37 +0100
committerDaniel Stenberg <daniel@haxx.se>2023-01-04 09:15:37 +0100
commit7ad8a7ba9ebdedceafe8859d3bd4d22ee447648d (patch)
tree09e568b07541857b31aa6ba431a239d328380216 /lib
parentbb393e521ffc217d14faf3812861278086ac84aa (diff)
downloadcurl-7ad8a7ba9ebdedceafe8859d3bd4d22ee447648d.tar.gz
noproxy: support for space-separated names is deprecated
To be removed in July 2024. Assisted-by: Michael Osipov Fixes #10209 Closes #10215
Diffstat (limited to 'lib')
-rw-r--r--lib/noproxy.c13
-rw-r--r--lib/noproxy.h3
-rw-r--r--lib/url.c6
3 files changed, 19 insertions, 3 deletions
diff --git a/lib/noproxy.c b/lib/noproxy.c
index 6c0c486f8..f1c1ed2c6 100644
--- a/lib/noproxy.c
+++ b/lib/noproxy.c
@@ -119,8 +119,10 @@ enum nametype {
* Checks if the host is in the noproxy list. returns TRUE if it matches and
* therefore the proxy should NOT be used.
****************************************************************/
-bool Curl_check_noproxy(const char *name, const char *no_proxy)
+bool Curl_check_noproxy(const char *name, const char *no_proxy,
+ bool *spacesep)
{
+ *spacesep = FALSE;
/*
* If we don't have a hostname at all, like for example with a FILE
* transfer, we have nothing to interrogate the noproxy list with.
@@ -244,6 +246,15 @@ bool Curl_check_noproxy(const char *name, const char *no_proxy)
if(match)
return TRUE;
} /* if(tokenlen) */
+ /* pass blanks after pattern */
+ while(ISBLANK(*p))
+ p++;
+ /* if not a comma! */
+ if(*p && (*p != ',')) {
+ *spacesep = TRUE;
+ continue;
+ }
+ /* pass any number of commas */
while(*p == ',')
p++;
} /* while(*p) */
diff --git a/lib/noproxy.h b/lib/noproxy.h
index b6a1a556a..a3a680772 100644
--- a/lib/noproxy.h
+++ b/lib/noproxy.h
@@ -37,7 +37,8 @@ UNITTEST bool Curl_cidr6_match(const char *ipv6,
unsigned int bits);
#endif
-bool Curl_check_noproxy(const char *name, const char *no_proxy);
+bool Curl_check_noproxy(const char *name, const char *no_proxy,
+ bool *spacesep);
#endif
diff --git a/lib/url.c b/lib/url.c
index e531a821c..f90427f9b 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2401,6 +2401,7 @@ static CURLcode create_conn_helper_init_proxy(struct Curl_easy *data,
char *socksproxy = NULL;
char *no_proxy = NULL;
CURLcode result = CURLE_OK;
+ bool spacesep = FALSE;
/*************************************************************
* Extract the user and password from the authentication string
@@ -2447,7 +2448,8 @@ static CURLcode create_conn_helper_init_proxy(struct Curl_easy *data,
}
if(Curl_check_noproxy(conn->host.name, data->set.str[STRING_NOPROXY] ?
- data->set.str[STRING_NOPROXY] : no_proxy)) {
+ data->set.str[STRING_NOPROXY] : no_proxy,
+ &spacesep)) {
Curl_safefree(proxy);
Curl_safefree(socksproxy);
}
@@ -2456,6 +2458,8 @@ static CURLcode create_conn_helper_init_proxy(struct Curl_easy *data,
/* if the host is not in the noproxy list, detect proxy. */
proxy = detect_proxy(data, conn);
#endif /* CURL_DISABLE_HTTP */
+ if(spacesep)
+ infof(data, "space-separated NOPROXY patterns are deprecated");
Curl_safefree(no_proxy);