PAC-K009 · host-not-lowercased

Case-sensitive host comparisons without lower-casing host

low · Compatibility across engines

Chrome, Edge and Firefox lower-case the hostname before calling the PAC. On Windows, programs that use WinHTTP (system services, BITS) pass it as typed, while WinINet, .NET and Java programs lower-case it. Lower-casing host once at the top of the function makes the file behave the same everywhere.

Why it matters

DNS names are case-insensitive, string comparisons in JavaScript are not. Where the engine normalises host to lower case the extra call is a no-op; where it does not, a user typing HTTPS://Intranet.Corp.Example misses every lower-case rule and takes the default route. One line, host = host.toLowerCase();, removes the dependency on engine behaviour. The literals must be lower case as well (PAC-C018).

How to fix

Add host = host.toLowerCase(); as the first statement of FindProxyForURL and keep all literals lower case.

Examples

Bad

function FindProxyForURL(url, host) {
  if (dnsDomainIs(host, ".corp.example")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
Open bad example in checker

Good

function FindProxyForURL(url, host) {
  host = host.toLowerCase();
  if (dnsDomainIs(host, ".corp.example")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
Open good example in checker

Engine behaviour

EngineBehaviourSource
chromiumThe host is passed lower-cased (Case-Http.Example.COM arrives as case-http.example.com, FD00::A1 as fd00::a1). The host part of url is lower-cased too; the path keeps its case. In the source, services/proxy_resolver/proxy_resolver_v8.cc passes the canonical URL's HostNoBrackets().lab, verified 2026-10-15
firefoxThe host is passed lower-cased (Case-Http.Example.COM arrives as case-http.example.com, FD00::A1 as fd00::a1), and so is the host part of url. In the source, netwerk/base/nsPACMan.cpp takes the normalised URI's GetAsciiHost().lab, verified 2026-10-15
pacparserPasses host as given to pactester; case-sensitive comparison.lab, verified 2026-05-20
winhttpThe host is passed with the case the program used (Example.COM stays Example.COM); BITS showed the same. An IPv6 host arrives in brackets with its case kept.lab, verified 2026-10-11
wininetPrograms using WinINet, .NET Framework, .NET 8 and Java passed the host lower-cased, and the host part of url too; the path keeps its case. An IPv6 address keeps its letters ([FD00::A1] stays [FD00::A1]).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.

The PAC functions this rule is about

  • dnsDomainIs(): True if host ends with domain. A plain string suffix comparison, no DNS lookup.

Related rules

References

Last updated: