PAC-C012 · ipv6-not-handled

IPv4 loopback/private ranges handled, IPv6 equivalents not

info · Correctness

The PAC routes 127.0.0.0/8 or RFC 1918 literals DIRECT but has no equivalent for ::1, link-local or unique-local IPv6 addresses. IPv6 literal hosts take the default route, usually the proxy.

Why it matters

An IPv6 address in the URL reaches the script in a different form in each engine. Chrome, Edge and Firefox pass it without brackets and in lower case: http://[FD00::A1]/ arrives as fd00::a1. WinHTTP (Windows services and many programs) and WinINet (desktop programs) pass it in brackets and with the letters as they were written: [FD00::A1]. pacparser passes the host it is given. A guard that accepts only IPv4 addresses rejects all of these forms, and isInNet cannot handle them, so local IPv6 services are sent to the proxy, where the connection usually fails. On networks with both IPv4 and IPv6, this shows up as tickets that say “works with the IP, not with the name” or the reverse. isInNetEx exists only in some engines (PAC-K003). The portable way is a string test on the well-known prefixes, after the host has been put into lower case and its brackets have been removed.

How to fix

Lower-case the host and remove its brackets, then add host == "::1" and prefix checks for fe80:, fc and fd next to the IPv4 loopback and private rules, or document that IPv6 addresses are meant to go to the proxy.

Examples

Bad

function FindProxyForURL(url, host) {
  if (/^\d+\.\d+\.\d+\.\d+$/.test(host) && isInNet(host, "127.0.0.0", "255.0.0.0")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
Open bad example in checker

Good

function FindProxyForURL(url, host) {
  // Windows passes [FD00::A1], browsers pass fd00::a1: compare without brackets, in lower case
  var h = host.toLowerCase().replace(/^\[(.*)\]$/, "$1");
  if (h == "::1" || shExpMatch(h, "fe80:*") || shExpMatch(h, "fc*:*") || shExpMatch(h, "fd*:*")) {
    return "DIRECT";
  }
  if (/^\d+\.\d+\.\d+\.\d+$/.test(host) && isInNet(host, "127.0.0.0", "255.0.0.0")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
Open good example in checker

Engine behaviour

EngineBehaviourSource
chromiumAn IPv6 address in the URL reaches the script without brackets (http://[fd00::10]:8090/ arrives as host fd00::10).lab, verified 2026-10-15
firefoxAn IPv6 address in the URL reaches the script without brackets (http://[fd00::10]:8090/ arrives as host fd00::10).lab, verified 2026-10-15
pacparserPasses the host exactly as it is given (pactester -h, or the second argument of find_proxy). When no host is given, pactester and the Python module take it from the URL up to the first colon, so http://[fd00::10]:8090/ gives the host [fd00 and no IPv6 test can match.code, verified 2026-10-15 · ref
winhttpAn IPv6 address reaches the script in brackets and with its letters as written (http://[fd00::10]:8090/ arrives as host [fd00::10], http://[FD00::A1]:8090/ as [FD00::A1]); the host part of url keeps them too.lab, verified 2026-10-15
wininetDesktop programs that use WinINet pass an IPv6 address in brackets and with its letters as written ([FD00::A1] stays [FD00::A1]), although they lower-case ordinary host names.lab, verified 2026-10-15

Source: code = read in the engine's source, doc = vendor documentation, lab = observed in a lab run, expert = practitioner knowledge, not yet verified.

Related rules

References

Last updated: