Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2015-04-22 02:12:10 -0400
committerGreg Wilkins2015-04-22 02:12:10 -0400
commiteee2a531978c798d49c94562acca4a07be6cfd5f (patch)
tree68db4926aeaa8674ef3ef8809f9b2b62340e6021 /jetty-servlets
parentc3577bbbb0a7505c3d808e34c3755ff55f3b7ad4 (diff)
parenta7bd9d1dd9b65645c78fa449a0a600f63e8bf19e (diff)
downloadorg.eclipse.jetty.project-eee2a531978c798d49c94562acca4a07be6cfd5f.tar.gz
org.eclipse.jetty.project-eee2a531978c798d49c94562acca4a07be6cfd5f.tar.xz
org.eclipse.jetty.project-eee2a531978c798d49c94562acca4a07be6cfd5f.zip
Merge remote-tracking branch 'origin/jetty-9.2.x'
Diffstat (limited to 'jetty-servlets')
-rw-r--r--jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java
index 9df0c0d0c2..634af8c81c 100644
--- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java
+++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java
@@ -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)

Back to the top