1

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.

Community
  • 1
  • 1
DRapp
  • 47,638
  • 12
  • 72
  • 142

3 Answers3

4

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/");
  • Thanks for your option... I'll keep it in mind the next time I need to attempt Proxy settings. I don't remember the outcome of how we handled from 1+ year ago original post. – DRapp Sep 23 '13 at 12:22
2

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

Community
  • 1
  • 1
1

No, libcurl does not support that.

Daniel Stenberg
  • 54,736
  • 17
  • 146
  • 222