Issue #911 encode requestURI in startAsync(req,res)
This commit is contained in:
parent
1247380976
commit
4312995d89
|
@ -2239,7 +2239,7 @@ public class Request implements HttpServletRequest
|
|||
_async=new AsyncContextState(state);
|
||||
AsyncContextEvent event = new AsyncContextEvent(_context,_async,state,this,servletRequest,servletResponse);
|
||||
event.setDispatchContext(getServletContext());
|
||||
event.setDispatchPath(URIUtil.encodePath(URIUtil.addPaths(getServletPath(),getPathInfo())));
|
||||
event.setDispatchPath(URIUtil.addPaths(getServletPath(),getPathInfo()));
|
||||
state.startAsync(event);
|
||||
return _async;
|
||||
}
|
||||
|
|
|
@ -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:URIUtil.encodePath(context.getContextPath()), path));
|
||||
baseRequest.setURIPathQuery(URIUtil.encodePath(URIUtil.addPaths(context==null?null:context.getContextPath(), path)));
|
||||
HttpURI uri = baseRequest.getHttpURI();
|
||||
baseRequest.setPathInfo(uri.getDecodedPath());
|
||||
if (uri.getQuery()!=null)
|
||||
|
|
|
@ -112,11 +112,11 @@ public class EncodedURITest
|
|||
@Test
|
||||
public void testTestServlet() throws Exception
|
||||
{
|
||||
String response = _connector.getResponse("GET /context%20path/test%20servlet/path%20info HTTP/1.0\n\n");
|
||||
String response = _connector.getResponse("GET /c%6Fntext%20path/test%20servlet/path%20info HTTP/1.0\n\n");
|
||||
assertThat(response,startsWith("HTTP/1.1 200 "));
|
||||
assertThat(response,Matchers.containsString("requestURI=/context%20path/test%20servlet/path%20info"));
|
||||
assertThat(response,Matchers.containsString("servletPath=/test servlet"));
|
||||
assertThat(response,Matchers.containsString("requestURI=/c%6Fntext%20path/test%20servlet/path%20info"));
|
||||
assertThat(response,Matchers.containsString("contextPath=/context path"));
|
||||
assertThat(response,Matchers.containsString("servletPath=/test servlet"));
|
||||
assertThat(response,Matchers.containsString("pathInfo=/path info"));
|
||||
}
|
||||
|
||||
|
@ -126,8 +126,8 @@ public class EncodedURITest
|
|||
String response = _connector.getResponse("GET /context%20path/test%20servlet/path%20info?async=true HTTP/1.0\n\n");
|
||||
assertThat(response,startsWith("HTTP/1.1 200 "));
|
||||
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("servletPath=/test servlet"));
|
||||
assertThat(response,Matchers.containsString("pathInfo=/path info"));
|
||||
}
|
||||
|
||||
|
@ -137,10 +137,23 @@ 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 "));
|
||||
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("servletPath=/test servlet"));
|
||||
assertThat(response,Matchers.containsString("pathInfo=/path info"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAsyncServletTestServlet() throws Exception
|
||||
{
|
||||
String response = _connector.getResponse("GET /context%20path/async%20servlet/path%20info HTTP/1.0\n\n");
|
||||
assertThat(response,startsWith("HTTP/1.1 200 "));
|
||||
assertThat(response,Matchers.containsString("requestURI=/context%20path/test%20servlet/path%20info"));
|
||||
assertThat(response,Matchers.containsString("contextPath=/context path"));
|
||||
assertThat(response,Matchers.containsString("servletPath=/test servlet"));
|
||||
assertThat(response,Matchers.containsString("pathInfo=/path info"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static class TestServlet extends HttpServlet
|
||||
|
|
Loading…
Reference in New Issue