GeneratePac command

From m204wiki
Revision as of 21:22, 30 January 2023 by Ekern (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Action:

Generates a PAC (Proxy Auto Config) JavaScript file from the Debugger configuration settings in debuggerConfig.xml. If this file is defined to the Internet Explorer browser, IE will use the Debugger Client as a proxy only for requests for the hosts (Onlines) specified in debuggerConfig.xml.

The IE browser does this host filtering if the PAC file location is specified for it in the Address value in Tools > Internet options > Connections > LAN settings > Use automatic configuration script.

By default, generatePac merges the code it generates with that of an existing PAC file (if such a file is already specified in the Internet Explorer configuration options).  

Syntax:

generatePac [file [overwrite|nomerge]] 

Where file is the name of a file which, if not specified, defaults to debuggerInternalPac.js. The generated file is placed by default in the Client workfile folder. If no such work folder is configured, the Client installation folder is used.

If you specify a file value:

  • You can use quotation marks to indicate an absolute or relative Windows file system path:  
    • If quoted (for example, generatePac "c:\pac\debuggerPac.js"), the file value is treated as an absolute file path.  
    • If not quoted (for example, generatePac foo.js), the value is treated as a path relative to the workfile folder.
  • You can also use a file URL (for example, file://c:\xxx\yyy.js ) to specify the file.

If a file with the same name as file already exists, it will not be overwritten, unless you specify overwrite. If you use overwrite, the file value must be explicitly specified.

Note: If your file specification contains an error (typo, incorrect file or path name, etc.), the Internet Explorer browser ignores the command and does not inform you of the error.

When generatePac runs, it reports its activity in the Debugger Client console. For example:  

Command: generatePac foo.js overwrite
Generated New Pac file: foo.js
Added: 5 web servers from the configuration.
Generated Pac File:
// foo.js generated by debugger client on: 2013 05 23 15:59:20
function FindProxyForURL(url, host) {
   urlLc = url.toLowerCase();
   isDebuggable = (
      (shExpMatch(urlLc, "http://sirius-software.com:3666/*%22)
         ||
      (shExpMatch(urlLc, "http://sirius-software.com:9219/*%22))
         ||
      (shExpMatch(urlLc, "http://sirius-software.com:3667/*%22)
         ||
      (shExpMatch(urlLc, "http://sirius-software.com:3000/*%22)
         ||
      (shExpMatch(urlLc, "http://sirius-software.com:80/*%22)
         ||
      (shExpMatch(urlLc, "http://sirius-software.com/*%22)
   );
   if (isDebuggable) return "PROXY 127.0.0.1:8081;DIRECT";
   return "DIRECT";

The quoted host URLs above are copied from the debuggerConfig.xml file. The last of them (with no explicit port number appended) is generated when a port 80 specification is present in debuggerConfig.xml.  

See also the setIEMode command, which combines the generatePac functionality with automatic specification and removal of the PAC file in the IE configuration settings when the Client starts and closes.

Client menu: --
Introduced: Build 62