mirror of
https://github.com/curl/curl.git
synced 2026-07-24 22:37:18 +03:00
parent
e8a4068e68
commit
ff2aaed9ba
2 changed files with 42 additions and 58 deletions
|
|
@ -185,8 +185,6 @@ static bool match_ip(int type, const char *token, size_t tokenlen,
|
|||
****************************************************************/
|
||||
bool Curl_check_noproxy(const char *name, const char *no_proxy)
|
||||
{
|
||||
char hostip[128];
|
||||
|
||||
/*
|
||||
* If we do not have a hostname at all, like for example with a FILE
|
||||
* transfer, we have nothing to interrogate the noproxy list with.
|
||||
|
|
@ -202,37 +200,23 @@ bool Curl_check_noproxy(const char *name, const char *no_proxy)
|
|||
if(no_proxy && no_proxy[0]) {
|
||||
const char *p = no_proxy;
|
||||
size_t namelen;
|
||||
char address[16];
|
||||
enum nametype type = TYPE_HOST;
|
||||
if(!strcmp("*", no_proxy))
|
||||
return TRUE;
|
||||
|
||||
/* NO_PROXY was specified and it was not just an asterisk */
|
||||
|
||||
if(name[0] == '[') {
|
||||
char *endptr;
|
||||
/* IPv6 numerical address */
|
||||
endptr = strchr(name, ']');
|
||||
if(!endptr)
|
||||
return FALSE;
|
||||
name++;
|
||||
namelen = endptr - name;
|
||||
if(namelen >= sizeof(hostip))
|
||||
return FALSE;
|
||||
memcpy(hostip, name, namelen);
|
||||
hostip[namelen] = 0;
|
||||
name = hostip;
|
||||
/* Check if name is an IP address; if not, assume it being a hostname. */
|
||||
namelen = strlen(name);
|
||||
if(curlx_inet_pton(AF_INET, name, &address) == 1)
|
||||
type = TYPE_IPV4;
|
||||
else if(curlx_inet_pton(AF_INET6, name, &address) == 1)
|
||||
type = TYPE_IPV6;
|
||||
}
|
||||
else {
|
||||
unsigned int address;
|
||||
namelen = strlen(name);
|
||||
if(curlx_inet_pton(AF_INET, name, &address) == 1)
|
||||
type = TYPE_IPV4;
|
||||
else {
|
||||
/* ignore trailing dots in the hostname */
|
||||
if(name[namelen - 1] == '.')
|
||||
namelen--;
|
||||
}
|
||||
/* ignore trailing dots in the hostname */
|
||||
if(name[namelen - 1] == '.')
|
||||
namelen--;
|
||||
}
|
||||
|
||||
while(*p) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue