diff options
Diffstat (limited to 'libs/libcurl/src/noproxy.c')
-rw-r--r-- | libs/libcurl/src/noproxy.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/libs/libcurl/src/noproxy.c b/libs/libcurl/src/noproxy.c index 8580235b56..f1f40aeaa5 100644 --- a/libs/libcurl/src/noproxy.c +++ b/libs/libcurl/src/noproxy.c @@ -26,9 +26,10 @@ #ifndef CURL_DISABLE_PROXY
-#include "inet_pton.h"
+#include "curlx/inet_pton.h"
#include "strcase.h"
#include "noproxy.h"
+#include "curlx/strparse.h"
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
@@ -53,9 +54,9 @@ UNITTEST bool Curl_cidr4_match(const char *ipv4, /* 1.2.3.4 address */ /* strange input */
return FALSE;
- if(1 != Curl_inet_pton(AF_INET, ipv4, &address))
+ if(1 != curlx_inet_pton(AF_INET, ipv4, &address))
return FALSE;
- if(1 != Curl_inet_pton(AF_INET, network, &check))
+ if(1 != curlx_inet_pton(AF_INET, network, &check))
return FALSE;
if(bits && (bits != 32)) {
@@ -71,7 +72,7 @@ UNITTEST bool Curl_cidr4_match(const char *ipv4, /* 1.2.3.4 address */ return FALSE;
return TRUE;
}
- return (address == check);
+ return address == check;
}
UNITTEST bool Curl_cidr6_match(const char *ipv6,
@@ -91,9 +92,9 @@ UNITTEST bool Curl_cidr6_match(const char *ipv6, rest = bits & 0x07;
if((bytes > 16) || ((bytes == 16) && rest))
return FALSE;
- if(1 != Curl_inet_pton(AF_INET6, ipv6, address))
+ if(1 != curlx_inet_pton(AF_INET6, ipv6, address))
return FALSE;
- if(1 != Curl_inet_pton(AF_INET6, network, check))
+ if(1 != curlx_inet_pton(AF_INET6, network, check))
return FALSE;
if(bytes && memcmp(address, check, bytes))
return FALSE;
@@ -162,7 +163,7 @@ bool Curl_check_noproxy(const char *name, const char *no_proxy) else {
unsigned int address;
namelen = strlen(name);
- if(1 == Curl_inet_pton(AF_INET, name, &address))
+ if(1 == curlx_inet_pton(AF_INET, name, &address))
type = TYPE_IPV4;
else {
/* ignore trailing dots in the hostname */
@@ -177,8 +178,7 @@ bool Curl_check_noproxy(const char *name, const char *no_proxy) bool match = FALSE;
/* pass blanks */
- while(*p && ISBLANK(*p))
- p++;
+ curlx_str_passblanks(&p);
token = p;
/* pass over the pattern */
@@ -234,7 +234,7 @@ bool Curl_check_noproxy(const char *name, const char *no_proxy) /* if the bits variable gets a crazy value here, that is fine as
the value will then be rejected in the cidr function */
bits = (unsigned int)atoi(slash + 1);
- *slash = 0; /* null terminate there */
+ *slash = 0; /* null-terminate there */
}
if(type == TYPE_IPV6)
match = Curl_cidr6_match(name, check, bits);
@@ -247,8 +247,7 @@ bool Curl_check_noproxy(const char *name, const char *no_proxy) return TRUE;
} /* if(tokenlen) */
/* pass blanks after pattern */
- while(ISBLANK(*p))
- p++;
+ curlx_str_passblanks(&p);
/* if not a comma, this ends the loop */
if(*p != ',')
break;
|