Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The function you're looking for is WinHttpGetIEProxyConfigForCurrentUser(), which is documented at <a href="http://msdn.microsoft.com/en-us/library/aa384096(VS.85).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/aa384096(VS.85).aspx</a>. This function is used by Firefox and Opera to get their proxy settings by default, although you can override them per-browser. Don't do that, though. The right thing to do (which is what everybody else does) is to just get the IE settings and assume that they're correct, since they almost always are.</p> <p>Here's a sample of the relevant logic, which you should adapt for your needs:</p> <pre><code>if( WinHttpGetIEProxyConfigForCurrentUser( &amp;ieProxyConfig ) ) { if( ieProxyConfig.fAutoDetect ) { fAutoProxy = TRUE; } if( ieProxyConfig.lpszAutoConfigUrl != NULL ) { fAutoProxy = TRUE; autoProxyOptions.lpszAutoConfigUrl = ieProxyConfig.lpszAutoConfigUrl; } } else { // use autoproxy fAutoProxy = TRUE; } if( fAutoProxy ) { if ( autoProxyOptions.lpszAutoConfigUrl != NULL ) { autoProxyOptions.dwFlags = WINHTTP_AUTOPROXY_CONFIG_URL; } else { autoProxyOptions.dwFlags = WINHTTP_AUTOPROXY_AUTO_DETECT; autoProxyOptions.dwAutoDetectFlags = WINHTTP_AUTO_DETECT_TYPE_DHCP | WINHTTP_AUTO_DETECT_TYPE_DNS_A; } // basic flags you almost always want autoProxyOptions.fAutoLogonIfChallenged = TRUE; // here we reset fAutoProxy in case an auto-proxy isn't actually // configured for this url fAutoProxy = WinHttpGetProxyForUrl( hiOpen, pwszUrl, &amp;autoProxyOptions, &amp;autoProxyInfo ); } if ( fAutoProxy ) { // set proxy options for libcurl based on autoProxyInfo } else { if( ieProxyConfig.lpszProxy != NULL ) { // IE has an explicit proxy. set proxy options for libcurl here // based on ieProxyConfig // // note that sometimes IE gives just a single or double colon // for proxy or bypass list, which means "no proxy" } else { // there is no auto proxy and no manually configured proxy } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload