add backslash test

This commit is contained in:
Jörg Prante 2020-03-10 16:41:42 +01:00
parent 5bd9ab2d2b
commit a544e8f550
2 changed files with 10 additions and 2 deletions

View file

@ -1,5 +1,5 @@
#Wed Nov 06 21:26:30 CET 2019 #Tue Mar 10 16:34:18 CET 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View file

@ -139,6 +139,14 @@ class URLParserTest {
assertEquals("http://foo.com/@", url.toExternalForm()); assertEquals("http://foo.com/@", url.toExternalForm());
} }
@Test
void testBackslashHost() {
URL url = URL.from("https://malicious.com\\google.com");
assertEquals("malicious.com", url.getDecodedHost());
assertEquals("/google.com", url.getPath());
assertEquals("https://malicious.com/google.com", url.toExternalForm());
}
@Test @Test
void testQuery() { void testQuery() {
URL url = URL.from("http://auth@foo.bar:1/path?query"); URL url = URL.from("http://auth@foo.bar:1/path?query");