Sets the proxy host name and port for a specific protocol.
By using the domain parameter, a “proxy stack” can be specified with multiple WebSetProxy calls. The last call has the highest priority. Using this functionality a PAC file like behaviour can be implemented.
WebAPI.bdh
WebSetProxy( in nProxy : number, in sHost : string, in nPort : number, in sDomain: string optional ): boolean;
true if successful
false otherwise
Parameter | Description |
---|---|
nProxy |
Proxy type. Can be one of the following types:
|
sHost | Host name of the proxy server |
nPort | Port the proxy server listens to |
sDomain | If specified the proxy is only used by sending requests to the specified domain. The domain parameter may contain a wildcard (*) character either at the beginning or at the end. Multiple calls to WebSetProxy can be made, where the latest one has the top priority (proxy stack). Specifying an empty string ("") for the sHost parameter means no proxy for the specified domain or domain pattern. |
dcltrans transaction TWebInit begin // Set up proxy connection using the WebSetting commands WebSetProxy(WEB_PROXY_HTTP, "proxy.mydomain.com", 80); WebSetProxyBypass(FALSE, NULL); // Set password used for authentication WebSetProxyAuth("proxyuser", "proxypass"); end TWebInit; transaction TWebInit1 begin WebSetProxy(WEB_PROXY_HTTP, "proxy", 8080, "www*"); //use this proxy for all hosts starting with "www" (priority 4) WebSetProxy(WEB_PROXY_HTTP, "", 0, "www.microsoft.com"); //but go directly to www.microsoft.com (priority 3) WebSetProxy(WEB_PROXY_HTTP, "proxy", 8081, "*yahoo.com"); //use proxy on a different port for all "yahoo.com" domains (priority 2) WebSetProxy(WEB_PROXY_HTTP, "proxy", 8082, "www.yahoo.com"); //use proxy on a different port for all "www.yahoo.com" domains (priority 1) end TWebInit1;