I had someone ask me for help writing a Proxy AutoConfiguration script today.  PAC files are basically simple JavaScript files that expose one function, FindProxyForURL(url, host). The function returns a string containing a list of one or more proxies which should be used when sending requests to the specified url/hostname. If no proxy should be used, the function returns "DIRECT." 

A few notes:

  • By default, failure to download the policy is silent, but the DisplayScriptDownloadFailureUI policy may be set to inform the user in the event of failure.
  • PAC files may be either manually specified (Tools / Internet Options / Connections / Lan Settings / Automatic configuration script) or automatically discovered using WPAD (controlled via the "Automatically Detect Settings" checkbox on the same dialog).
  • Results of the function are cached by default for performance reasons.
  • Back in the Vista timeframe, the WinINET team added some new functionality to ensure that PAC files could properly work in an IPv6 environment.  A summary of their changes can be found in this blog post: http://blogs.msdn.com/wndp/articles/IPV6_PAC_Extensions_v0_9.aspx
  • As an aside: PAC files can have an (often unexpected) impact on Zone Determination, as I described almost 4 years ago (sheesh, time flies!).