435653 encode async dispatched requestURI
This commit is contained in:
parent
b38a978eac
commit
c72649e150
|
@ -18,6 +18,7 @@
|
|||
|
||||
package org.eclipse.jetty.server;
|
||||
|
||||
import java.awt.geom.PathIterator;
|
||||
import java.io.IOException;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.net.InetAddress;
|
||||
|
@ -513,16 +514,15 @@ public class Server extends HandlerWrapper implements Attributes
|
|||
|
||||
final Request baseRequest=connection.getRequest();
|
||||
final String path=event.getPath();
|
||||
|
||||
|
||||
if (path!=null)
|
||||
{
|
||||
// this is a dispatch with a path
|
||||
ServletContext context=event.getServletContext();
|
||||
HttpURI uri = new HttpURI(URIUtil.encodePath(context==null?path:URIUtil.addPaths(context.getContextPath(),path)));
|
||||
HttpURI uri = new HttpURI(URIUtil.addPaths(context==null?null:context.getContextPath(), path));
|
||||
baseRequest.setUri(uri);
|
||||
baseRequest.setRequestURI(null);
|
||||
baseRequest.setPathInfo(uri.getDecodedPath());
|
||||
|
||||
if (uri.getQuery()!=null)
|
||||
baseRequest.mergeQueryParameters(uri.getQuery(), true); //we have to assume dispatch path and query are UTF8
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ import org.eclipse.jetty.server.ServerConnector;
|
|||
import org.eclipse.jetty.server.handler.RequestLogHandler;
|
||||
import org.eclipse.jetty.toolchain.test.AdvancedRunner;
|
||||
import org.eclipse.jetty.util.IO;
|
||||
import org.eclipse.jetty.util.URIUtil;
|
||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.After;
|
||||
|
@ -706,7 +707,13 @@ public class AsyncServletTest
|
|||
{
|
||||
((HttpServletResponse)async.getResponse()).addHeader("history","resume");
|
||||
if (path!=null)
|
||||
async.dispatch(path);
|
||||
{
|
||||
int q=path.indexOf('?');
|
||||
String uriInContext=(q>=0)
|
||||
?URIUtil.encodePath(path.substring(0,q))+path.substring(q)
|
||||
:URIUtil.encodePath(path);
|
||||
async.dispatch(uriInContext);
|
||||
}
|
||||
else
|
||||
async.dispatch();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue