diff --git a/CHANGELOG.md b/CHANGELOG.md index d9b73af..ec7a923 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ * Reinstated env var support in `appbase` property. +* Fixed issue with `myIpAddress()` in PAC proxy support. + ## 1.8.6 - June 4, 2019 * Fixed issues with PAC proxy support: added `myIpAddress()`, fixed `dnsResolve()`, fixed crash diff --git a/launcher/src/main/resources/com/threerings/getdown/launcher/PacUtils.js b/launcher/src/main/resources/com/threerings/getdown/launcher/PacUtils.js index 96a644e..db4263b 100644 --- a/launcher/src/main/resources/com/threerings/getdown/launcher/PacUtils.js +++ b/launcher/src/main/resources/com/threerings/getdown/launcher/PacUtils.js @@ -23,6 +23,10 @@ function dnsResolve (host) { return resolver.dnsResolve(host) } +function myIpAddress () { + return resolver.myIpAddress() +} + function isInNet (addrOrHost, pattern, maskstr) { var testRE = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/; var test = testRE.exec(addrOrHost); diff --git a/launcher/src/test/java/com/threerings/getdown/launcher/ProxyUtilTest.java b/launcher/src/test/java/com/threerings/getdown/launcher/ProxyUtilTest.java index e60ab90..43ee670 100644 --- a/launcher/src/test/java/com/threerings/getdown/launcher/ProxyUtilTest.java +++ b/launcher/src/test/java/com/threerings/getdown/launcher/ProxyUtilTest.java @@ -6,6 +6,7 @@ package com.threerings.getdown.launcher; import java.io.StringReader; +import java.net.InetAddress; import java.net.URL; import org.junit.Test; @@ -133,5 +134,12 @@ public class ProxyUtilTest { // return 'DIRECT'; // } // } + + String MYIP = + "function FindProxyForURL(url, host) {\n" + + " return 'PROXY ' + myIpAddress() + ':8080';\n" + + "}"; + String myIp = InetAddress.getLocalHost().getHostAddress(); + testPAC(MYIP, "http://testurl.com/", "PROXY " + myIp + ":8080"); } }