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 95ab4110069..39a617c9cd7 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 @@ -148,6 +148,32 @@ public class RequestTest assertTrue(responses.startsWith("HTTP/1.1 200")); } + @Test + public void testParamExtraction_BadSequence() throws Exception + { + _handler._checker = new RequestTester() + { + @Override + public boolean check(HttpServletRequest request,HttpServletResponse response) + { + Map map = request.getParameterMap(); + // should have thrown a BadMessageException + return false; + } + }; + + //Send a request with query string with illegal hex code to cause + //an exception parsing the params + String request="GET /?test_%e0%x8%81=missing HTTP/1.1\r\n"+ + "Host: whatever\r\n"+ + "Content-Type: text/html;charset=utf8\n"+ + "Connection: close\n"+ + "\n"; + + String responses=_connector.getResponses(request); + assertThat("Responses", responses, startsWith("HTTP/1.1 400")); + } + @Test public void testEmptyHeaders() throws Exception {