Window client application 使用IE的http代理配置访问外网
IE的proxy配置有3种:
1. 指定proxy server的ip和port
2. Automatically detect settings: WPAD
3. Use automatic configuration url: 指定PAC文件url
Firefox/Opera/Chrome都是使用IE的proxy配置.我们通过WinHttp DLL中的api可以拿到这个配置对应的proxy server和port.
Mac上可以使用系统设置里面的proxy setting, CFProxySupport API.
WPAD是Web Proxy Auto Discovery的缩写,意思是Web代理服务器自动发现(通过dhcp/dns)
http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol
How does Windows actually detect LAN (proxy) settings when using Automatic Configuration:
http://stackoverflow.com/questions/191023/how-does-windows-actually-detect-lan-proxy-settings-when-using-automatic-confi
Detect Windows (IE) proxy settings changes:
http://stackoverflow.com/questions/6192563/detect-windows-ie-proxy-settings-changes
Netsh.exe and ProxyCfg.exe Proxy Configuration Tools:
http://msdn.microsoft.com/en-us/library/aa384069%28v=VS.85%29.aspx
Using PAC(Proxy auto-config) files proxy:
http://www.codeproject.com/Articles/12168/Using-PAC-files-proxy
http://msdn.microsoft.com/en-us/library/aa384096(v=vs.85).aspx
window中使用WinHttp DLL中的WinHttpGetIEProxyConfigForCurrentUser: retrieves the Internet Explorer proxy configuration for the current user.
This function is used by Firefox and Opera to get their proxy settings by default.
*********How do I find out the browser's proxy settings?:
http://stackoverflow.com/questions/202547/how-do-i-find-out-the-browsers-proxy-settings
PAC自动代理文件格式,教你如何写PAC文件
http://www.truevue.org/javascript/pac-format
iOS/OS X使用cfproxysupport来拿到系统的proxy configuration.
wpad.dat文件需要放在web server根目录下, 并设content-type为application/x-ns-proxy-autoconfig
wpad.dat文件的内容格式如下:
function FindProxyForURL(url, host) {
if (shExpMatch(host, “127.*”)
|| shExpMatch(host, “localhost”)
//|| shExpMatch(url, “*.tahubachem.net/*”)
|| isPlainHostName(host)
//|| dnsDomainIs(host, “.tahubachem.net”))
{
return “DIRECT”;
}else{
return “PROXY X.X.X.x:8080; DIRECT;”;
// return “PROXY 123.123.123.123:8080; DIRECT;”;
}
}
LibCurl also support proxy already:
CURLOPT_PROXYTYPE
Pass a long with this option to set type of the proxy. Availableoptions for this are CURLPROXY_HTTP, CURLPROXY_HTTP_1_0(added in 7.19.4), CURLPROXY_SOCKS4 (added in 7.10), CURLPROXY_SOCKS5, CURLPROXY_SOCKS4A (added in 7.18.0) and CURLPROXY_SOCKS5_HOSTNAME (added in 7.18.0). The HTTP type isdefault. (Added in 7.10)
If you set CURLOPT_PROXYTYPE to CURLPROXY_HTTP_1_0, it will only affect howlibcurl speaks to a proxy when CONNECT is used. The HTTP version used for"regular" HTTP requests is instead controlled with CURLOPT_HTTP_VERSION.
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html
libcurl支持通过window SSPI 读取当前登录的域用户来进行代理的NTLM验证.
http://stackoverflow.com/questions/1276955/ntlm-proxy-without-password?rq=1
配置squid集成域身份认证: http://penglei.name/html/337.html
域环境下配置squid的IE代理自动检测设置: http://penglei.name/html/341.html
HTTP代理与SPDY协议: http://blog.jobbole.com/42763/