diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java index 39a617c9cd7..2715829accb 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java @@ -100,6 +100,7 @@ public class RequestTest _server.setHandler(_handler); ErrorHandler errors = new ErrorHandler(); + errors.setServer(_server); errors.setShowStacks(true); _server.addBean(errors); _server.start(); @@ -1382,6 +1383,42 @@ public class RequestTest assertEquals("14316.133020.1.1.utr=gna.de|ucn=(real)|utd=reral|utct=/games/hen-one,gnt-50-ba-keys:key,2072262.html", cookies.get(0).getValue()); } + + @Test + public void testBadCookies() throws Exception + { + final ArrayList cookies = new ArrayList<>(); + + _handler._checker = new RequestTester() + { + @Override + public boolean check(HttpServletRequest request,HttpServletResponse response) throws IOException + { + javax.servlet.http.Cookie[] ca = request.getCookies(); + if (ca!=null) + cookies.addAll(Arrays.asList(ca)); + response.getOutputStream().println("Hello World"); + return true; + } + }; + + String response; + + cookies.clear(); + response=_connector.getResponses( + "GET / HTTP/1.1\n"+ + "Host: whatever\n"+ + "Cookie: path=value\n" + + "Cookie: name=value\n" + + "Connection: close\n"+ + "\n" + ); + assertTrue(response.startsWith("HTTP/1.1 200 OK")); + assertEquals(1,cookies.size()); + assertEquals("name", cookies.get(0).getName()); + assertEquals("value", cookies.get(0).getValue()); + + } @Ignore("No longer relevant") @Test