@Test public void testURLNormalisation() { final String[][] TESTS = new String[][]{ {"http: {"http: {"https: {"https: {"http: {"https: {"https: {"https: {"http: {"/foo", "/foo", "/foo"}, {"/foo/", "/foo", "/foo"}, {"/%2A", "/%2a", "/*"}, {"/%2a", "/%2a", "/*"}, {"/%2a*", "/%2a*", "/**"}, {"/æblegrød", "/æblegrød", "/æblegrød"}, {"%C3%A6blegr%C3%B8d", "æblegrød", "æblegrød"}, {"/æblegrød og øl", "/æblegrød%20og%20øl", "/æblegrød%20og%20øl"}, {"Red, Rosé 14%", "red,%20rosé%2014%25", "red,%20rosé%2014%25"}, {"Red%2C%20Ros%C3%A9 14%25", "red%2c%20rosé%2014%25", "red,%20rosé%2014%25"}, {"/backslash\\", "/backslash%5c", "/backslash%5c"}, {"/backslash%5C", "/backslash%5c", "/backslash%5c"}, }; for (String[] test: TESTS) { assertEquals("The input '" + test[0] + "' should be normalised ambiguously as expected", test[1], Normalisation.canonicaliseURL(test[0], true, false)); assertEquals("The input '" + test[0] + "' should be normalised unambiguously as expected", test[2], Normalisation.canonicaliseURL(test[0], true, true)); } }
public static String canonicaliseURL(String url) { return canonicaliseURL(url, true, true); }
Normalisation { public static String canonicaliseURL(String url) { return canonicaliseURL(url, true, true); } }
Normalisation { public static String canonicaliseURL(String url) { return canonicaliseURL(url, true, true); }  }
Normalisation { public static String canonicaliseURL(String url) { return canonicaliseURL(url, true, true); }  static String sanitiseWARCHeaderValue(String value); static String canonicaliseHost(String host); static String canonicaliseURL(String url); static String fixURLErrors(String url); static String resolveRelative(String url, String relative); static String resolveRelative(String url, String relative, boolean normalise); static String canonicaliseURL(String url, boolean allowHighOrder, boolean createUnambiguous); }
Normalisation { public static String canonicaliseURL(String url) { return canonicaliseURL(url, true, true); }  static String sanitiseWARCHeaderValue(String value); static String canonicaliseHost(String host); static String canonicaliseURL(String url); static String fixURLErrors(String url); static String resolveRelative(String url, String relative); static String resolveRelative(String url, String relative, boolean normalise); static String canonicaliseURL(String url, boolean allowHighOrder, boolean createUnambiguous);  }