Download test PAC file






















This topic explains how to optimize the performance of an automatic proxy-configuration script PAC file, also known as Wpad. This document focuses on how to resolve issues with the intranet servers directly and external internal traffic through a proxy-server.

For more information about the functions that are used to evaluate an address URL or hostname , see: Use proxy autoconfiguration. Therefore, you should avoid, or, at least, minimize the use of these functions. NetBIOS names server names that contain no period are used in the intranet only and are not routed through the proxy:.

Internally used DNS zones are typically routed directly. The easiest way to determine such hosts is by using the dnsDomainis function:. An alternative and faster method for the same result can be obtained by using ShExMatch. This function does a string compare. If the IP address of the host belongs to the local intranet, regardless of the web server name, it should bypass the proxy in order to navigate directly. If the IP address is entered directly into the address bar, you do not have to resolve it again.

You can use the following code to check whether the host is already in the IP address format:. This code checks whether the variable host contains three numerals that are followed by a period and then followed by another numeral. The result is then passed to the variable return. The result is "true" for an IP and "false" otherwise. In the following code snippet, the variable host IP contains the IP address for use in future checks:. When a non-existing host is passed to the function for example, the user entered something wrong in the address bar , the result in host IP might be zero.

Any additional error handling will be done by the proxy:. Because we have the IP address of the host, the internal IP ranges have to be checked. Whenever possible, use the shExpMatch function instead of isInNet. The following code snippets have identical results, although shExpMatch runs faster:. The proxy script uses the JavaScript language.

JavaScript is case-sensitive. Therefore, an if clause that is uppercase will never become true, while other parameters use lowercase. Therefore, the parameters that are checked within the PAC file should be converted within the PAC before they are evaluated:. If the host domain name matches the provided domain information, the dnsDomainIs function returns true. In this example, if the host name can be resolved, it can connect directly. Specifically, this function requests the DNS server to resolve the host name it's passed.

If the name can be resolved, a direct connection is made. If it can't, the connection is made using a proxy. This is particularly useful when an internal DNS server is used to resolve all internal host names. References to Object Model objects, properties, or methods cause the proxy auto-configuration file to fail silently. For example, the references window.

In this example, if the host is in a specified subnet, it can connect directly. However, if the server is outside of the specified subnet, it must connect through a proxy server. Specifically, the isInNet host, pattern, mask function returns true if the host IP address matches the specified pattern. In this example, if the host is local, the server can connect directly. Specifically, the shExpMatch str, shexp function returns true if str matches the shexp using shell expression patterns.

This is particularly useful when the host domain name is one of the criteria for proxy selection. In this example, the in-use protocol is extracted from the server and used to make a proxy selection. If no protocol match occurs, the server is directly connected. Specifically the substring function extracts the specified number of characters from a string. This is particularly useful when protocol is one of the criteria for proxy selection.

In this example, the proxy server is selected by translating the host name into an IP address and then comparing the address to a specified string. In this example, the proxy server is selected by explicitly getting the IP address and then comparing it to a specified string.

If no protocol match occurs, the server makes a direct connection. Specifically, the myIpAddress function returns the IP address in integer-period format for the host that the browser is running on. In this example, the function looks to see if there are periods. If there are any periods, the connection occurs using a proxy server.

If there are no periods, a direct connection occurs. Specifically, the dnsDomainLevels function returns an integer equal to the number of periods in the host name. Note This is another way to determine connection types based on host name characteristics.



0コメント

  • 1000 / 1000