Pactester is an utility to test Proxy Auto-Configuration (PAC) files.
Usage: ./pactester < -p pacfile > < -u url > [-h host] [-c client_ip]
./pactester < -p pacfile > < -f urlslist > [-c client_ip]
-p pacfile: PAC file to test
-u url: URL to test
-h host: Host part of the URL
-c client_ip: client IP address (defaults to IP address of the machine on which script is running)
-f urlslist: a file containing list of URLs to be tested.
./pactester -p wpad.dat -u http://www.google.com
./pactester -p wpad.dat -u http://www.google.com -c 192.168.1.105
./pactester -p wpad.dat -f url_list
How It Works?
How to use it?
Pactester can be used to determine the proxy for a single URL or a list of URLs.
To determine the proxy for a single URL:
./pactester -p www.pac -u http://www.example.com
For a list of URLs :
./pactester -p www.pac -f urllist
where urllist is a file containing the list of URLs separated by newline.
Extending command line web clients:
Pactester can be also be used to extend command line web clients like curl and perl-libwww library.
To use it with curl: Right now, curl doesn't have the functionality to evaluate PAC files to find out proxy for a given URL. However, based on pactester, you can write a wrapper perl script around curl. This perl script will first find out the proxy for the URL, the way that pactester finds out, and then it will call curl with the option '-x "proxy server as returned by pactester method"'.
Similarly, this method can be used inside perl-libwww web clients too.