cURL / Mailing Lists / curl-users / Single Mail


Re: cURL and .pac files

From: Ralph Mitchell <>
Date: Tue, 25 Jun 2002 03:20:53 -0500

Me and my big mouth....

OK, after a stupendous effort (well, 5 seconds.... :) Altavista turned up the
"Navigator Proxy Auto-Config File Format" doc which listed the 12 predefined
functions you can use in a .pac file.

The Mozilla Cross Reference search thingy on the spidermonkey page at
turned up a link to nsProxyAutoConfig.js which, among other things, contains the
above mentioned 12 functions written in javascript.

To cut a long story short, I slapped the 12 functions on the front of my .pac
file, pushed it through the SpiderMonkey javascript engine, and got correct
results for the urls I asked it to check.

So, Daniel, barring discussion over licensing (Mozilla uses Netscape Public
License(duh!) as well as GPL and LGPL), etc, I'd say there's a workable .pac
interpreter for cURL... All it needs is some thought on bolting the two
together... I haven't really dug through cURL's source much, so I don't have the
slightest idea where to put it...

Ralph Mitchell

Ralph Mitchell wrote:

> Much as I would like to stun the entire world by adding a .pac reader to cURL,
> I'm afraid it's a little more complex than it looked at first.
> I found a couple of standalone javascript interpreters, compiled them up and
> ran our own .pac through them. I had to comment out two functions that were
> not found - dnsDomainIs and shExpMatch - which tells me that either both
> interpreters are incomplete, or the .pac interpreter is javascript+[some
> random number of other bits]. Since then I haven't had time to take it
> further.
> FYI, the interpreters I tried are NGS Javascript ( and
> SpiderMonkey (
> While it shouldn't be too hard to replicate the missing functions, I'd be
> surprised if those are the *only* missing functions.
> Ralph Mitchell
> Daniel Stenberg wrote:
> > On Fri, 21 Jun 2002, Sarnicola, Anthony (Exchange) wrote:
> >
> > > Does cURL handle the Automatic Configuration .pac scripts (like in IE LAN
> > > Settings)?
> >
> > See FAQ item 3.14 =>
> >
> > Ralph Mitchell has hinted that he might have a go at an implementation one
> > day, but other than that, there are no plans to add support for this.

Sponsored by:
ThinkGeek at
Received on 2002-06-25