Merge remote-tracking branch 'origin/jetty-9.2.x'
This commit is contained in:
commit
37b4ba00b1
|
@ -64,6 +64,7 @@ public class TestFilter implements Filter
|
||||||
_remote=Boolean.parseBoolean(filterConfig.getInitParameter("remote"));
|
_remote=Boolean.parseBoolean(filterConfig.getInitParameter("remote"));
|
||||||
_allowed.add("/favicon.ico");
|
_allowed.add("/favicon.ico");
|
||||||
_allowed.add("/jetty_banner.gif");
|
_allowed.add("/jetty_banner.gif");
|
||||||
|
_allowed.add("/remote.html");
|
||||||
|
|
||||||
LOG.debug("TestFilter#remote="+_remote);
|
LOG.debug("TestFilter#remote="+_remote);
|
||||||
}
|
}
|
||||||
|
@ -76,18 +77,13 @@ public class TestFilter implements Filter
|
||||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||||
throws IOException, ServletException
|
throws IOException, ServletException
|
||||||
{
|
{
|
||||||
String from = request.getRemoteHost();
|
String from = request.getRemoteAddr();
|
||||||
String to = request.getServerName();
|
String to = request.getLocalAddr();
|
||||||
String path=((HttpServletRequest)request).getServletPath();
|
String path=((HttpServletRequest)request).getServletPath();
|
||||||
|
|
||||||
if (!"/remote.html".equals(path) && !_remote && !_allowed.contains(path) && (
|
if (!_remote && !_allowed.contains(path) && !from.equals(to))
|
||||||
!from.equals("localhost") && !from.startsWith("127.") && from.indexOf(":1")<0 ||
|
|
||||||
!to.equals("localhost")&&!to.startsWith("127.0.0.") && to.indexOf(":1")<0))
|
|
||||||
{
|
{
|
||||||
if ("/".equals(path))
|
_context.getRequestDispatcher("/remote.html").forward(request,response);
|
||||||
_context.getRequestDispatcher("/remote.html").forward(request,response);
|
|
||||||
else
|
|
||||||
((HttpServletResponse)response).sendRedirect("/remote.html");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue