aboutsummaryrefslogtreecommitdiff
path: root/test/js-unittest/simple.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/js-unittest/simple.js')
-rw-r--r--test/js-unittest/simple.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/js-unittest/simple.js b/test/js-unittest/simple.js
new file mode 100644
index 0000000..c5dfa6d
--- /dev/null
+++ b/test/js-unittest/simple.js
@@ -0,0 +1,21 @@
+// PAC script which uses isInNet on both IP addresses and hosts, and calls
+// isResolvable().
+
+function FindProxyForURL(url, host) {
+ var my_ip = myIpAddress();
+
+ if (isInNet(my_ip, "172.16.0.0", "255.248.0.0")) {
+ return "PROXY a:80";
+ }
+
+ if (url.substring(0, 6) != "https:" &&
+ isInNet(host, "10.0.0.0", "255.0.0.0")) {
+ return "PROXY b:80";
+ }
+
+ if (dnsDomainIs(host, "foo.bar.baz.com") || !isResolvable(host)) {
+ return "PROXY c:100";
+ }
+
+ return "DIRECT";
+}