cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: curl and automatic proxy configuration/various sundry things

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 21 May 2002 08:57:15 +0200 (MET DST)

On Tue, 21 May 2002, Ralph Mitchell wrote:

> I haven't had a chance to refine it yet, so my script expects an *exact*
> number of redirects, which is a little unreliable... I know curl is peachy
> keen at following redirects, especially with the recent fixes, but for just
> this one site I can't let it do that because of the need to switch the
> proxy on/off in flight.

It might be possible to craft this using the "no_proxy" variable.

> Would an auto-proxy config reader need to be a complete javascript
> interpreter, or would a subset do? The auto-config I get from our proxy
> (using curl :) has stuff like this:
>
> if ((host.substring(0, 9) == "127.0.0.1") ||
> (host.toUpperCase() == "XXX.DOMAIN.COM") ||
> (host.substring(0, 13) == "10.133.96.252") ||
> (host.substring(0, 7) == "172.29."))
> return "DIRECT";

[snip]

> and so on, for 358 lines of code. That's much less daunting than a whole
> javascript implementation... I may even take a whack at it myself... :)

Well, of course that particular piece of code doesn't need a full javascript
interpreter. I would even guess that most PAC files are of this simple
construction and would be fairly easy to parse.

Still, you need to write an engine that deals with some ten to twenty
function calls and a full expression parser etc.

> So, Daniel, if a proxy_or_not() function fell out of the sky one day, would
> it be possible to patch it into curl? I'm guessing it would need at least
> one more command-line arg:
>
> -apc http://apc.domain.com:port/proxyconfig.pac
>
> because the auto-proxy config I have to use doesn't come from the actual
> proxy - at least, the machine name is different - probably to avoid
> looping, or something.

Oh sure! It would certainly fit, and I would certainly join in and improve it
from my end too.

I once wrote a script language myself, that supported expressions and
function calls pretty much in the way we need here, so I have some
experiences to offer. (The code itself is too old and crazy written to be
good for re-use here, for reference check out:
http://www.contactor.se/~dast/fpl-old/)

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
Received on 2002-05-21