Reputation: 1249
I have a C++ program which I want to use on my clients machines. However, some of my clients are behind proxies. Therefore, I want my program to automatically detect these proxies.
I have tried many solutions, such as reading the registry for the proxy settings, trying the Windows API's, etc.
However none of them have worked out well. E.g. the registry sometimes holds the url for the PAC-file and sometimes the actual proxy-address itself. Besides that, I haven't been able to find any username and password related to the proxy if it is set on the client machine (which some users say they have).
So, basically my question is: How can I automatically determine the proxy settings of my clients in C++ so I can use the proxy-settings in my LibCurl requests later on regarding:
I can't get it to work and I have been trying it for two weeks now without any improvement...
Upvotes: 2
Views: 3093
Reputation: 330
How can I automatically determine the proxy settings of my clients in C++ so I can use the proxy-settings in my LibCurl requests?
libproxy
is the answer!
It has these features according to the home page:
- support for all major platforms: Windows, Mac and Linux/UNIX (see upcoming 0.4 release)
- extremely small core footprint
- no external dependencies within libproxy core (libproxy plugins may have dependencies)
- only 3 functions in the stable-ish external API (1.0 will offer full stability)
- dynamic adjustment to changing network topology
- a standard way of dealing with proxy settings across all scenarios
- a sublime sense of joy and accomplishment
Upvotes: 0
Reputation: 62613
You can not read proxy setting in a generic way, since every application is free to store it in any way it wants. You should be able to read Internet Explorer proxy by using WinHttpGetIEProxyConfigForCurrentUser function, and it would also work for users browsers which use this setting, like Google Chrome.
Upvotes: 3