curl-library
Life with and without a proxy
Date: Mon, 16 Jan 2006 17:13:54 -0800
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
Received on 2006-01-17