manugarg / pacparser

A library to parse proxy auto-config (PAC) files
http://pacparser.manugarg.com
GNU Lesser General Public License v3.0
506 stars 116 forks source link

isResolvable() returns true for some ip's but not others #135

Closed programmerPhysicist closed 1 year ago

programmerPhysicist commented 2 years ago

The function isResolvable appears to sometimes return true for some local ip that should be unresolvable on my local network, but returns false for some ip's that should be resolvable on my local network.

If you have a proxy.pac file:

function FindProxyForURL(url, host) {
  if (isResolvable(host))
  {
    return "DIRECT";
  }
  else
  {
    return "PROXY 192.168.1.150:8080";
  }
}

the above behavior occurs.

manugarg commented 2 years ago

This is the logic this function uses: https://github.com/manugarg/pacparser/blob/536b93b4f475cd91aeb3ff31da6ff7a73fef1baf/src/pacparser.c#L117

Given that pacparser is used by so many people and possibly in many environments, and nothing has changed in the DNS resolve function for a long time now, I'd look at your local environment carefully.

For all the hosts for which pactester is not behaving properly, can you share what other resolvers (host, dig, etc) say about those hosts.

manugarg commented 1 year ago

Please feel free to reopen if it's still an issue.