cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Life with and without a proxy

From: Karl M <karlm30_at_hotmail.com>
Date: Mon, 16 Jan 2006 17:40:49 -0800

Hi Allan...

Good point. I can get my desired result. I was asking what libcurl behavior
would be because it has much of that logic in place now and if I got what I
wanted directly from libcurl, that would be great.

Thanks,

...Karl

>From: man
>Subject: Re: Life with and without a proxy
>Date: Tue, 17 Jan 2006 01:24:08 -0000
>
>i do not know what curl will do in this case, but remember, you can look
>at whatever env vars you want in your program, and not send curl the
>CURLOPT_PROXY* options if they are not there. you can even do better than
>that and use a config file or command line switches. thats what i do with
>libcurl.
>
>allan
>
>On Mon, Jan 16, 2006, Karl M <karlm30_at_hotmail.com> said:
>
> > Hi All...
> >
> > If I use libcurl like this
> >
> >
> >
> >
> > curl_global_init(CURL_GLOBAL_ALL);
> > curl = curl_easy_init();
> > if(curl) {
> > curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, ":");
> > curl_easy_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_ANYSAFE);
> >
> > curl_easy_setopt(curl, CURLOPT_URL, url);
> >
> > curl_easy_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, TRUE);
> > curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, TRUE);
> >
> > res = curl_easy_perform(curl);
> >
> > curl_easy_getinfo(curl, CURLINFO_SOCKET, &local);
> >
> > /* transfer data */
> >
> > curl_easy_cleanup(curl);
> > }
> >
> > curl_global_cleanup();
> >
> >
> >
> >
> > and then specify the proxy with an environment variable, I should get
>the
> > socket for the transfer after the proxy connection and authentication
>have
> > been completed.
> >
> > But if I don't set any environment variables for the proxy, do I get a
> > direct connection to my target? Or, will I get some error condition?
> >
> > Is my question clear?
> >
> > I would like to dynamically control whether or not the proxy is used
>from
> > the environment variables...and get a usable socket (either direct or
> > proxytunneled) for my raw data transfer.
> >
> > Thanks,
> >
> > ...Karl
> >
> >
> >
>
>--
>m. allan noah
>IT Director, TfHS.net
>ph# (804) 355-5489
>tf# (866) 724-9722
>fx# (804) 355-0477
>
>
Received on 2006-01-17