diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java b/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java index 0385c8ed663..d4e5119a3df 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java @@ -401,6 +401,9 @@ public class PathMap extends HashMap public static boolean match(String pathSpec, String path, boolean noDefault) throws IllegalArgumentException { + if (pathSpec.length()==0) + return "/".equals(path); + char c = pathSpec.charAt(0); if (c=='/') { diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java index 36e9b2e1581..65481f14351 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java @@ -138,6 +138,8 @@ public class PathMapTest assertTrue("!match *.foo", !PathMap.match("*.foo", "anything.bar")); assertEquals("match / with ''", "10", p.getMatch("/").getValue()); + + assertTrue("match \"\"", PathMap.match("", "/")); } /**