Merge remote-tracking branch 'origin/master' into jetty-9.1
This commit is contained in:
commit
1d77a139fd
|
@ -45,6 +45,7 @@ public class HttpExchange
|
||||||
private volatile Throwable requestFailure;
|
private volatile Throwable requestFailure;
|
||||||
private volatile Throwable responseFailure;
|
private volatile Throwable responseFailure;
|
||||||
|
|
||||||
|
|
||||||
public HttpExchange(HttpConversation conversation, HttpDestination destination, Request request, List<Response.ResponseListener> listeners)
|
public HttpExchange(HttpConversation conversation, HttpDestination destination, Request request, List<Response.ResponseListener> listeners)
|
||||||
{
|
{
|
||||||
this.conversation = conversation;
|
this.conversation = conversation;
|
||||||
|
|
|
@ -2611,7 +2611,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
||||||
if (dot<0)
|
if (dot<0)
|
||||||
return false;
|
return false;
|
||||||
String suffix=path.substring(dot);
|
String suffix=path.substring(dot);
|
||||||
return resource.getAlias().toString().endsWith(suffix);
|
return resource.toString().endsWith(suffix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2627,10 +2627,10 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
||||||
public boolean check(String path, Resource resource)
|
public boolean check(String path, Resource resource)
|
||||||
{
|
{
|
||||||
int slash = path.lastIndexOf('/');
|
int slash = path.lastIndexOf('/');
|
||||||
if (slash<0)
|
if (slash<0 || slash==path.length()-1)
|
||||||
return false;
|
return false;
|
||||||
String suffix=path.substring(slash);
|
String suffix=path.substring(slash);
|
||||||
return resource.getAlias().toString().endsWith(suffix);
|
return resource.toString().endsWith(suffix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
@ -2644,7 +2644,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
||||||
public boolean check(String path, Resource resource)
|
public boolean check(String path, Resource resource)
|
||||||
{
|
{
|
||||||
int slash = path.lastIndexOf('/');
|
int slash = path.lastIndexOf('/');
|
||||||
if (slash<0)
|
if (slash<0 || resource.exists())
|
||||||
return false;
|
return false;
|
||||||
String suffix=path.substring(slash);
|
String suffix=path.substring(slash);
|
||||||
return resource.getAlias().toString().endsWith(suffix);
|
return resource.getAlias().toString().endsWith(suffix);
|
||||||
|
|
|
@ -30,8 +30,8 @@ import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.jetty.security.HashLoginService;
|
import org.eclipse.jetty.security.HashLoginService;
|
||||||
|
import org.eclipse.jetty.server.NetworkConnector;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.server.nio.SelectChannelConnector;
|
|
||||||
import org.eclipse.jetty.servlet.DefaultServlet;
|
import org.eclipse.jetty.servlet.DefaultServlet;
|
||||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
import org.eclipse.jetty.servlet.ServletHolder;
|
import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
|
@ -67,6 +67,7 @@ public class JspAndDefaultWithAliasesTest
|
||||||
|
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
data.add(new String[] { "false","/dump.jsp" });
|
data.add(new String[] { "false","/dump.jsp" });
|
||||||
|
data.add(new String[] { "false","/dump.jsp/" });
|
||||||
data.add(new String[] { "true", "/dump.jsp%00" });
|
data.add(new String[] { "true", "/dump.jsp%00" });
|
||||||
data.add(new String[] { "false","/dump.jsp%00/" });
|
data.add(new String[] { "false","/dump.jsp%00/" });
|
||||||
data.add(new String[] { "false","/dump.jsp%00x/dump.jsp" });
|
data.add(new String[] { "false","/dump.jsp%00x/dump.jsp" });
|
||||||
|
@ -86,10 +87,7 @@ public class JspAndDefaultWithAliasesTest
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void startServer() throws Exception
|
public static void startServer() throws Exception
|
||||||
{
|
{
|
||||||
server = new Server();
|
server = new Server(0);
|
||||||
SelectChannelConnector connector = new SelectChannelConnector();
|
|
||||||
connector.setPort(0);
|
|
||||||
server.addConnector(connector);
|
|
||||||
|
|
||||||
// Configure LoginService
|
// Configure LoginService
|
||||||
HashLoginService login = new HashLoginService();
|
HashLoginService login = new HashLoginService();
|
||||||
|
@ -119,7 +117,9 @@ public class JspAndDefaultWithAliasesTest
|
||||||
|
|
||||||
server.start();
|
server.start();
|
||||||
|
|
||||||
serverURI = new URI("http://localhost:" + connector.getLocalPort() + "/");
|
int port = ((NetworkConnector)server.getConnectors()[0]).getLocalPort();
|
||||||
|
|
||||||
|
serverURI = new URI("http://localhost:" + port + "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
|
|
|
@ -30,8 +30,8 @@ import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.jetty.security.HashLoginService;
|
import org.eclipse.jetty.security.HashLoginService;
|
||||||
|
import org.eclipse.jetty.server.NetworkConnector;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.server.nio.SelectChannelConnector;
|
|
||||||
import org.eclipse.jetty.servlet.DefaultServlet;
|
import org.eclipse.jetty.servlet.DefaultServlet;
|
||||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
import org.eclipse.jetty.servlet.ServletHolder;
|
import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
|
@ -68,6 +68,7 @@ public class JspAndDefaultWithoutAliasesTest
|
||||||
|
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
data.add(new Object[] { "/dump.jsp" });
|
data.add(new Object[] { "/dump.jsp" });
|
||||||
|
data.add(new Object[] { "/dump.jsp/" });
|
||||||
data.add(new Object[] { "/dump.jsp%00" });
|
data.add(new Object[] { "/dump.jsp%00" });
|
||||||
data.add(new Object[] { "/dump.jsp%00x" });
|
data.add(new Object[] { "/dump.jsp%00x" });
|
||||||
data.add(new Object[] { "/dump.jsp%00x/dump.jsp" });
|
data.add(new Object[] { "/dump.jsp%00x/dump.jsp" });
|
||||||
|
@ -87,10 +88,7 @@ public class JspAndDefaultWithoutAliasesTest
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void startServer() throws Exception
|
public static void startServer() throws Exception
|
||||||
{
|
{
|
||||||
server = new Server();
|
server = new Server(0);
|
||||||
SelectChannelConnector connector = new SelectChannelConnector();
|
|
||||||
connector.setPort(0);
|
|
||||||
server.addConnector(connector);
|
|
||||||
|
|
||||||
// Configure LoginService
|
// Configure LoginService
|
||||||
HashLoginService login = new HashLoginService();
|
HashLoginService login = new HashLoginService();
|
||||||
|
@ -120,7 +118,8 @@ public class JspAndDefaultWithoutAliasesTest
|
||||||
|
|
||||||
server.start();
|
server.start();
|
||||||
|
|
||||||
serverURI = new URI("http://localhost:" + connector.getLocalPort() + "/");
|
int port = ((NetworkConnector)server.getConnectors()[0]).getLocalPort();
|
||||||
|
serverURI = new URI("http://localhost:" + port + "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
|
|
Loading…
Reference in New Issue