WinHTTP AutoProxy Support
To ease the configuration of proxy settings, WinHTTP 5.1 implements the Web Proxy Auto-Discovery (WPAD) protocol, also known as autoproxy.
Applications and components that use WinHTTP to send HTTP requests should ensure that the proxy configuration is set correctly. Unless the client has a direct Internet connection, an HTTP request should normally be sent through a web proxy server that connects the client's local network to the Internet (for example, this is often the case for Web clients on a corporate LAN). For server-based applications, the proxy configuration is normally managed by the server's administrator using the WinHTTP ProxyCfg.exe utility. The server administrator knows the name of the proxy server in advance and uses ProxyCfg.exe to record this setting in the registry where WinHTTP can look it up. However, requiring client desktop end-users to manually configure WinHTTP proxy settings is problematic. The end-user may not know the name of the proxy server; requiring the end-user to run the ProxyCfg.exe utility can be a support burden for an organization. To support a good user experience, a web-enabled client application should determine the proxy configuration without user intervention.
To make configuring the proxy settings for WinHTTP-based applications easier, WinHTTP now implements the Web Proxy Auto-Discovery (WPAD) protocol, often referred to as autoproxy. This is the same protocol that web browsers implement to automatically discover the proxy configuration without requiring an end-user to specify a proxy server manually. This feature is available starting with WinHTTP version 5.1 in Windows 2000 Service Pack 3, Windows XP Service Pack 1 and Windows Server 2003. Note that although both Microsoft Internet Explorer and Microsoft WinHTTP support WPAD, the specification never progressed beyond the "Internet-Draft" stage, and expired in May 2001.
The WPAD protocol works as follows:
- Using the DHCP and/or DNS network protocols, the URL of a Proxy Auto-Configuration (PAC) file is discovered. The URL identifies a PAC file on the client's local network. WinHTTP supports only "http:" and "https:" PAC URLs; it does not, for example, support "file:" URLS.
- The PAC file is downloaded and optionally cached on the client's computer. The PAC file is an executable script that generates a list of one or more proxy servers given a target host name and URL. WinHTTP supports only ECMAScript-based PAC files.
- On each HTTP request, the PAC script code is executed, with the host name and URL of the HTTP request passed in as parameters. WinHTTP expects the PAC script code to contain a function called FindProxyForURL, in the form:
FindProxyForURL( url, host );
- WinHTTP AutoProxy Functions
- Discovery Without an Auto-Config File
- AutoProxy Issues in WinHTTP
- Setting WinInet Proxy Configurations in WinHTTP
- AutoProxy Cache
- IPv6 Extensions to Navigator Auto-Config File Format
Build date: 10/26/2012