Issue #911 encode requestURI in startAsync(req,res)

This commit is contained in:
Greg Wilkins 2016-09-09 09:09:51 +10:00
parent f7d017ca1a
commit 1247380976
2 changed files with 2 additions and 3 deletions

View File

@ -552,7 +552,7 @@ public class Server extends HandlerWrapper implements Attributes
// this is a dispatch with a path
ServletContext context=event.getServletContext();
String query=baseRequest.getQueryString();
baseRequest.setURIPathQuery(URIUtil.addPaths(context==null?null:context.getContextPath(), path));
baseRequest.setURIPathQuery(URIUtil.addPaths(context==null?null:URIUtil.encodePath(context.getContextPath()), path));
HttpURI uri = baseRequest.getHttpURI();
baseRequest.setPathInfo(uri.getDecodedPath());
if (uri.getQuery()!=null)

View File

@ -136,8 +136,7 @@ public class EncodedURITest
{
String response = _connector.getResponse("GET /context%20path/test%20servlet/path%20info?async=true&wrap=true HTTP/1.0\n\n");
assertThat(response,startsWith("HTTP/1.1 200 "));
// TODO this contextPath should be encoded
assertThat(response,Matchers.containsString("requestURI=/context path/test%20servlet/path%20info"));
assertThat(response,Matchers.containsString("requestURI=/context%20path/test%20servlet/path%20info"));
assertThat(response,Matchers.containsString("servletPath=/test servlet"));
assertThat(response,Matchers.containsString("contextPath=/context path"));
assertThat(response,Matchers.containsString("pathInfo=/path info"));