Warning, /frameworks/kio/src/kpac/kpactest2.pac is written in an unsupported language. File is not indexed.

0001 /*
0002    A script to test Microsoft's IPv6 extension to the PAC specification. If
0003    you want to test the original PAC specification, use 'kpactest.pac'.
0004 
0005    To use this script, select "Use automatic proxy configuration URL:" in the
0006    KDE proxy configuration dialog and run:
0007 
0008    qdbus org.kde.kded5 /modules/proxyscout proxyForUrl http://blah (URL doesn't matter)
0009 
0010    If everything succeeds, the output you get will be http://<your IP>/. If not,
0011    you would get http://<your IP>/<test-result> where <test-result> contains the
0012    tests that "failed". You can lookup the failed test name in the comments below
0013    and file a report in the KDE bug tracking system if you feel the problem is in
0014    the implementation.
0015 
0016    Please note that since myIpAddressEx returns a semi-colon delimited list of all the
0017    valid ip address for your machine matches, including the IPv6 representations for
0018    the same network interface, you should always see at least two http://<your IP>/
0019    in the result.
0020 */
0021 
0022 function FindProxyForURLEx( url, host )
0023 {
0024     var result = "";
0025 
0026     // isResolvableEx1
0027     // on failure make sure you can resolve www.kde.org correctly :-)
0028     if ( !isResolvableEx( "www.kde.org" ) )
0029         result += "/isResolvableEx1=failed";
0030     // isResolvableEx2
0031     // on failure make sure dummy.invalid doesn't resolve :-)
0032     if ( isResolvableEx( "dummy.invalid" ) )
0033         result += "/isResolvableEx2=failed";
0034 
0035     // isInNetEx1
0036     // on failure check if localhost resolves to 127.0.0.1 as it should
0037     if ( isInNetEx( "localhost", "1.2.3.4/8" ) )
0038         result += "/isInNetEx1=failed";
0039     // isInNetEx2
0040     if ( isInNetEx( "1.2.3.4", "1.2.3.5/32" ) )
0041         result += "/isInNetEx2=failed";
0042     // isInNetEx3
0043     if ( !isInNetEx( "1.2.3.4", "1.2.3.5/24" ) )
0044         result += "/isInNetEx3=failed";
0045 
0046     // dnsResolveEx1
0047     // on failure check if localhost resolves to 127.0.0.1 as it should
0048     if ( dnsResolveEx( "localhost" ).indexOf("127.0.0.1") == -1 )
0049         result += "/dnsResolveEx1=failed";
0050 
0051     // sortIpAddressList
0052     var sorted = sortIpAddressList("2001:4898:28:3:201:2ff:feea:fc14;157.59.139.22;fe80::5efe:157.59.139.2");
0053     if ( sorted != "fe80::5efe:157.59.139.2;2001:4898:28:3:201:2ff:feea:fc14;157.59.139.22" )
0054         result += "/sortIpAddressList=failed";
0055 
0056     var output = new Array();
0057     var items = myIpAddressEx().split(";");
0058     for (var i = 0; i < items.length; ++i) {
0059         var entry = "PROXY http://" + items[i] + result;
0060         output[i] = entry;
0061     }
0062 
0063     return output.join(';');
0064 }