Merge remote-tracking branch 'origin/jetty-9.2.x'

This commit is contained in:
Greg Wilkins 2015-04-22 16:12:10 +10:00
commit eee2a53197
2 changed files with 23 additions and 1 deletions

View File

@ -577,6 +577,9 @@ public abstract class AbstractSessionManager extends ContainerLifeCycle implemen
_sessionAttributeListeners.remove(listener);
if (listener instanceof HttpSessionListener)
_sessionListeners.remove(listener);
if (listener instanceof HttpSessionIdListener)
_sessionIdListeners.remove(listener);
removeBean(listener);
}
/* ------------------------------------------------------------ */

View File

@ -577,7 +577,7 @@ public class DoSFilter implements Filter
if (tracker == null)
{
boolean allowed = checkWhitelist(_whitelist, request.getRemoteAddr());
boolean allowed = checkWhitelist(request.getRemoteAddr());
int maxRequestsPerSec = getMaxRequestsPerSec();
tracker = allowed ? new FixedRateTracker(loadId, type, maxRequestsPerSec)
: new RateTracker(loadId, type, maxRequestsPerSec);
@ -600,6 +600,25 @@ public class DoSFilter implements Filter
return tracker;
}
protected boolean checkWhitelist(String candidate)
{
for (String address : _whitelist)
{
if (address.contains("/"))
{
if (subnetMatch(address, candidate))
return true;
}
else
{
if (address.equals(candidate))
return true;
}
}
return false;
}
@Deprecated
protected boolean checkWhitelist(List<String> whitelist, String candidate)
{
for (String address : whitelist)