<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>jjgod / blog &#187; pac</title>
	<atom:link href="http://blog.jjgod.org/tag/pac/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.jjgod.org</link>
	<description>Random notes &#38; thoughts by Jiang Jiang.</description>
	<lastBuildDate>Mon, 16 Jan 2012 11:08:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to test a proxy autoconfiguration file</title>
		<link>http://blog.jjgod.org/2009/01/29/how-to-test-a-proxy-pac/</link>
		<comments>http://blog.jjgod.org/2009/01/29/how-to-test-a-proxy-pac/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 05:38:48 +0000</pubDate>
		<dc:creator>jjgod</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[DOM | Scripting]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[gfw]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[pac]]></category>

		<guid isPermaLink="false">http://blog.jjgod.org/?p=348</guid>
		<description><![CDATA[Due to the existence of Greal Firewall, I have a terribly long proxy.pac file. Apparently, how to maintain that becomes a problem. Regularly, I use git to keep a &#8220;stable&#8221; version and make updates on it. Recently I just found the script stop working for no good reason, because the proxy server I&#8217;m using is [...]]]></description>
			<content:encoded><![CDATA[<p>Due to the existence of <a href="en.wikipedia.org/wiki/Golden_Shield_Project">Greal Firewall</a>, I have a terribly long <code>proxy.pac</code> file. Apparently, how to maintain that becomes a problem. Regularly, I use <a href="http://git-scm.com">git</a> to keep a &#8220;stable&#8221; version and make updates on it.</p>

<p>Recently I just found the script stop working for no good reason, because the proxy server I&#8217;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.</p>

<p>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&#8217;t want to do a binary search to find out the problem (Yep, I&#8217;m a lazy guy).</p>

<p>A few googling got me a tool called <a href="http://code.google.com/p/pactester/">pactester</a>, which turned out to be very useful. Basically it&#8217;s a Perl wrap of <a href="http://www.mozilla.org/js/spidermonkey">SpiderMonkey</a> JavaScript engine. Since the proxy autoconfiguration script is just a subset of plain JavaScript, it can safely executes that with SpiderMonkey and find out where is the problem.</p>

<p>So I installed it and did one test:</p>

<pre><code>$ 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";
</code></pre>

<p>So that&#8217;s the problem. Fixed it, everything is back to normal again!</p>

<p>That&#8217;s a small tip on debugging a complex pac script, hope it helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jjgod.org/2009/01/29/how-to-test-a-proxy-pac/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

