Proxy Auto Config PAC

PAC files contain a javascript function that runs in a sandbox and can only execute a few specific functions.

No one tests these functions, found 3 bugs.

1. myIPAddress() returns the first IP address, not the one it's going to use for connection, therefore people with Virtual network adaptors tend to break things

2. timeRange() ignores DST, even though it has a specific GMT parameter

3. In WinHTTP (Internet Explorer and Edge) timeRange doesn't work with minutes/seconds, only hours, having the 6 parameter version causes the PAC parsing to crash, which means DIRECT is used

It's rather annoying to debug, for WinHTTP there's autoprox, for Chrome use chrome://net-internals click Capture, Reset. Proxy, re-apply settings, check the correct PAC file loads, then events and filter on PAC.

Use alert() in the PAC file to cause debug events to appear in net-internals

Links: MDN FindProxyForURL