Merge remote-tracking branch 'origin/master' into jetty-9.1

This commit is contained in:
Jan Bartel 2013-07-25 23:06:33 +10:00
commit 1d77a139fd
4 changed files with 17 additions and 17 deletions

View File

@ -44,6 +44,7 @@ public class HttpExchange
private final HttpResponse response;
private volatile Throwable requestFailure;
private volatile Throwable responseFailure;
public HttpExchange(HttpConversation conversation, HttpDestination destination, Request request, List<Response.ResponseListener> listeners)
{

View File

@ -2611,7 +2611,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
if (dot<0)
return false;
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)
{
int slash = path.lastIndexOf('/');
if (slash<0)
if (slash<0 || slash==path.length()-1)
return false;
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)
{
int slash = path.lastIndexOf('/');
if (slash<0)
if (slash<0 || resource.exists())
return false;
String suffix=path.substring(slash);
return resource.getAlias().toString().endsWith(suffix);

View File

@ -30,8 +30,8 @@ import java.util.Collection;
import java.util.List;
import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.server.NetworkConnector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
@ -67,6 +67,7 @@ public class JspAndDefaultWithAliasesTest
// @formatter:off
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[] { "false","/dump.jsp%00/" });
data.add(new String[] { "false","/dump.jsp%00x/dump.jsp" });
@ -86,10 +87,7 @@ public class JspAndDefaultWithAliasesTest
@BeforeClass
public static void startServer() throws Exception
{
server = new Server();
SelectChannelConnector connector = new SelectChannelConnector();
connector.setPort(0);
server.addConnector(connector);
server = new Server(0);
// Configure LoginService
HashLoginService login = new HashLoginService();
@ -118,8 +116,10 @@ public class JspAndDefaultWithAliasesTest
server.setHandler(context);
server.start();
int port = ((NetworkConnector)server.getConnectors()[0]).getLocalPort();
serverURI = new URI("http://localhost:" + connector.getLocalPort() + "/");
serverURI = new URI("http://localhost:" + port + "/");
}
@AfterClass

View File

@ -30,8 +30,8 @@ import java.util.Collection;
import java.util.List;
import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.server.NetworkConnector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
@ -68,6 +68,7 @@ public class JspAndDefaultWithoutAliasesTest
// @formatter:off
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%00x" });
data.add(new Object[] { "/dump.jsp%00x/dump.jsp" });
@ -87,10 +88,7 @@ public class JspAndDefaultWithoutAliasesTest
@BeforeClass
public static void startServer() throws Exception
{
server = new Server();
SelectChannelConnector connector = new SelectChannelConnector();
connector.setPort(0);
server.addConnector(connector);
server = new Server(0);
// Configure LoginService
HashLoginService login = new HashLoginService();
@ -119,8 +117,9 @@ public class JspAndDefaultWithoutAliasesTest
server.setHandler(context);
server.start();
serverURI = new URI("http://localhost:" + connector.getLocalPort() + "/");
int port = ((NetworkConnector)server.getConnectors()[0]).getLocalPort();
serverURI = new URI("http://localhost:" + port + "/");
}
@AfterClass