diff options
author | Jiri Vanek <[email protected]> | 2013-06-10 13:22:53 +0200 |
---|---|---|
committer | Jiri Vanek <[email protected]> | 2013-06-10 13:22:53 +0200 |
commit | faffea863331de3cb97e5654313922fafd61745c (patch) | |
tree | c7f73df08ef79b55c657c7ec2e4854ef9e27b8fc /tests/test-extensions-tests/net/sourceforge/jnlp/ServerAccessTest.java | |
parent | 1de22aca7c4d0627a8fbbec23fffd4ca463969ea (diff) |
Handled semicolon in internal server (with reproducers)
Diffstat (limited to 'tests/test-extensions-tests/net/sourceforge/jnlp/ServerAccessTest.java')
-rw-r--r-- | tests/test-extensions-tests/net/sourceforge/jnlp/ServerAccessTest.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test-extensions-tests/net/sourceforge/jnlp/ServerAccessTest.java b/tests/test-extensions-tests/net/sourceforge/jnlp/ServerAccessTest.java index 25415be..3ddd09e 100644 --- a/tests/test-extensions-tests/net/sourceforge/jnlp/ServerAccessTest.java +++ b/tests/test-extensions-tests/net/sourceforge/jnlp/ServerAccessTest.java @@ -217,6 +217,34 @@ public class ServerAccessTest { Assert.assertArrayEquals(b2, bb[1]); Assert.assertArrayEquals(b3, bb[2]); } + + @Test + public void stripHttpPathParamTest() { + String[] testBaseUrls = { + "http://foo.com/bar", + "localhost:8080", + "https://bar.co.uk/site;para/baz?u=param1&v=param2" + }; + + String[] testJarNames = { + "jar", + "foo.jar", + "bar;baz.jar", + "nom.jar;", + "rhat.jar.pack.gz;tag" + }; + + for (String url : testBaseUrls) { + for (String jar : testJarNames) { + String newUrl = TinyHttpdImpl.stripHttpPathParams(url), + newJar = TinyHttpdImpl.stripHttpPathParams(jar), + path = newUrl + "/" + newJar; + Assert.assertTrue("Base URL should not have been modified: " + url + " => " + newUrl, newUrl.equals(url)); + Assert.assertTrue("JAR name should not be altered other than removing path param: " + jar + " => " + newJar, jar.startsWith(newJar)); + Assert.assertTrue("New path should be a substring of old path: " + path + " => " + url + "/" + jar, (url + "/" + jar).startsWith(path)); + } + } + } private void printArrays(byte[][] bb) { System.out.println("[][] l=" + bb.length); |