From ee9c57e3ea1bf6e1442871a7865413d2aebf4443 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 26 Nov 2015 11:39:55 +1100 Subject: [PATCH] 482670 - HttpURI wrongly parser URI paths starting with /@ --- .../src/main/java/org/eclipse/jetty/http/HttpURI.java | 4 ---- .../java/org/eclipse/jetty/http/HttpURIParseTest.java | 7 +++++++ .../src/test/java/org/eclipse/jetty/http/HttpURITest.java | 8 +++++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java index 5da5dd45120..bd1ec11dd0d 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpURI.java @@ -301,10 +301,6 @@ public class HttpURI break; case '@': - _user=uri.substring(mark,i); - mark=i+1; - break; - case ';': case '?': case '#': diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpURIParseTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpURIParseTest.java index 232b5de3dfc..7f525726eaf 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpURIParseTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpURIParseTest.java @@ -98,6 +98,13 @@ public class HttpURIParseTest // Path with query alt syntax {"/path/info?a=;query",null,null,null,"/path/info",null,"a=;query",null}, + + // URI with host character + {"/@path/info",null,null,null,"/@path/info",null,null,null}, + {"/user@path/info",null,null,null,"/user@path/info",null,null,null}, + {"//user@host/info",null,"host",null,"/info",null,null,null}, + {"//@host/info",null,"host",null,"/info",null,null,null}, + {"@host/info",null,null,null,"@host/info",null,null,null}, // Scheme-less, with host and port (overlapping with path) {"//host:8080//",null,"host","8080","//",null,null,null}, diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpURITest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpURITest.java index 9771b5ccc4e..93a8cd1b92d 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpURITest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpURITest.java @@ -92,7 +92,13 @@ public class HttpURITest assertEquals(value,parameters.getString("value")); } } - + + @Test + public void testAt() throws Exception + { + HttpURI uri = new HttpURI("/@foo/bar"); + assertEquals("/@foo/bar",uri.getPath()); + } @Test public void testParams() throws Exception