410405 Avoid NPE for requestDispatcher(../)
Test double encoded dot dot
This commit is contained in:
parent
9b8a78392c
commit
2d661f18dd
|
@ -1867,8 +1867,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
|
|||
query = uriInContext.substring(q + 1);
|
||||
uriInContext = uriInContext.substring(0,q);
|
||||
}
|
||||
// if ((q = uriInContext.indexOf(';')) > 0)
|
||||
// uriInContext = uriInContext.substring(0,q);
|
||||
|
||||
String pathInContext = URIUtil.canonicalPath(URIUtil.decodePath(uriInContext));
|
||||
if (pathInContext!=null)
|
||||
|
|
|
@ -232,7 +232,20 @@ public class DispatcherTest
|
|||
_contextHandler.addServlet(DispatchServletServlet.class, "/dispatch/*");
|
||||
_contextHandler.addServlet(RogerThatServlet.class, "/roger/that");
|
||||
|
||||
String requests="GET /context/dispatch/test?forward=%2e%2e/roger/that HTTP/1.0\n" + "Host: localhost\n\n";
|
||||
String requests="GET /context/dispatch/test?forward=/%2e%2e/roger/that HTTP/1.0\n" + "Host: localhost\n\n";
|
||||
|
||||
String responses = _connector.getResponses(requests);
|
||||
|
||||
assertThat(responses,startsWith("HTTP/1.1 404 "));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testServletForwardEncodedDotDot() throws Exception
|
||||
{
|
||||
_contextHandler.addServlet(DispatchServletServlet.class, "/dispatch/*");
|
||||
_contextHandler.addServlet(RogerThatServlet.class, "/roger/that");
|
||||
|
||||
String requests="GET /context/dispatch/test?forward=/%252e%252e/roger/that HTTP/1.0\n" + "Host: localhost\n\n";
|
||||
|
||||
String responses = _connector.getResponses(requests);
|
||||
|
||||
|
|
Loading…
Reference in New Issue