Question

I'm working with LibCurl. I'm presented with a need to possibly handle going through a proxy server. From my current findings, I've found other posts that have presented proxy settings such as...

One such solution/sample showing the following.

curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_NTLM );
curl_setopt($ch, CURLOPT_PROXY, 'my.proxy');
curl_setopt($ch, CURLOPT_PROXYPORT, 'my.port');
curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'domain\user:password');  

My question. I've read other places that the Windows APIs can read whatever "proxy" settings are established from within Internet Explorer so we would not have to track that in our app. The security techs at the client would prepare their server, port, user, pwd, etc in I.E. and just go.

Does Libcurl also support this? If so, how.

Was it helpful?

Solution

No, libcurl does not support that.

OTHER TIPS

Theses lines did not work for me (I wanted it to hit fiddler):

curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_NTLM );
curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1");
curl_setopt($ch, CURLOPT_PROXYPORT, "8888");
//curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'domain\user:password'); //none in my case

Instead this single line worked:

curl_easy_setopt(curl, CURLOPT_PROXY, `"http://127.0.0.1:8888/");

Libcurl doesn't autodetect but you may use WinHttpGetIEProxyConfigForCurrentUser. See: How do I find out the browser's proxy settings?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top