Due to the existence of [Greal Firewall](en.wikipedia.org/wiki/Golden_Shield_Project), I have a terribly long `proxy.pac` file. Apparently, how to maintain that becomes a problem. Regularly, I use [git](http://git-scm.com) to keep a “stable” version and make updates on it.
Recently I just found the script stop working for no good reason, because the proxy server I’m using is working, and I tried manually choose a proxy server (by entering its address and port into my browser directly) it also worked, so apparently there is something wrong with the script.
However, it has been a while since I last commit my changes to this script back to git. So there are some changes I wish to keep and I don’t want to do a binary search to find out the problem (Yep, I’m a lazy guy).
So I installed it and did one test:
$ pactester -p ~/Documents/Miscs/proxy.pac -u ‘http://blog.iphone-dev.org’
Use of uninitialized value in numeric ne (!=) at pactester line 137.
Error: SyntaxError: missing ) after condition at line 98:
if (dnsDomainIs(host, “cubes.fr”) return “SOCKS 127.0.0.1:7777”;
So that’s the problem. Fixed it, everything is back to normal again!
That’s a small tip on debugging a complex pac script, hope it helps.
2 thoughts on “How to test a proxy autoconfiguration file”
Thanks for this post, I’ve been searching for AGES for something to test my wpad.dat files for things like the silly typo that you mention and this is very helpful, saved me a lot of heartache!
I also want to test my wpad.dat files but i find it hard because i really do not know some technical stuff. I will read this over and over again so that i can do it perfectly. Thanks!