Proxy Auto Config in Mozilla-Gagan Saksena 07/26/00
About this document INCOMPLETEThis document is obsolete, and remains purely for historical purposes. (See bug 128270)
Comments and feedback are always welcome. A significant section of this document is work in progress and is likely to be updated in future. If I get enough questions to require an FAQ, I will write one.
Here is a quick list of items this document covers--
- What is PAC?
Proxy Auto Config (PAC) has been supported in several versions of the Netscape browser. (Most of the version 3 and above browsers) Here is the original document that describes the Proxy Auto Config file format. Note that since its original implementation in Mozilla/2.0 a significant set of api's for PAC has been deprecated.
The implementation in Netscape's previous versions of the browser allowed for API calls (predefined functions) like weekdayRange(), dateRange(), etc. These functions are now deprecated. More about this later.
- Current implementation in Mozilla
Interfaces and ComponentsThe current implementation in Mozilla sets up a ProxyAutoConfig component. To read more about components check out this page.TODO
The nsIProxyAutoConfigUtils interface was originally designed to use and isolate the helper functions which are required for implementing the network helper functions like dnsResolve, isInNet, etc. For now the implementation of this interface is with the DNS service.
An end-to-end example
- Design considerations and notes
The way this whole thing works.
If available the FindProxyForURL function gets called for each and every URL loaded. This could be a big performance issue if the implementation is extensive.
- Future work/TODO
- Fix known problems.
Pull PAC off the servers.
Installation that moves/ports existing PAC files.
Native implementations of PACUtils.(deprecated)
- Fix known problems.
- Known problems
The problem existing is that currently there is no way to include a JS file in
The potential solutions-
-JS 2.0 could support include files.
-JS Context could be handed over to the new file.
-The existing workaround.
Append the existing PAC file with the raw one provided.
The exception with dynamically updated (PAC files on server)
- Multiple return values are ignored. Only the first one is tried. So "PROXY foo;bar; DIRECT" only tries foo. TODO-No bug assigned.
- Several JS stub functions are no-ops. TODO-No bug assigned.
- Installing an existing PAC file in Mozilla
Steps to install a PAC file
- If the PAC file is on a remote server then download the PAC file to a local copy.
- Copy mozilla/netwerk/base/src/nsProxyAutoConfig.js to mozilla/dist/bin/components (this step may not be needed if the file is already installed there!)
- Edit the nsProxyAutoConfig.js file in mozilla/dist/bin/components directory
and remove the sample implementation towards the end of the file starting with
//Sample implementation ...
- Append your existing PAC file (the one from step 1) to this file.
- Go to Edit->Preferences->Advanced->Proxies and select the "Automatic Proxy configuration URL:" radio button. There is no need to type anything in the URL field (that is currently ignored till bug 53080 is fixed)
- Restart your browser. You should see a console message that says something