Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2015-04-21 23:19:00 -0400
committerGreg Wilkins2015-04-21 23:19:00 -0400
commite97c726ccff5235ee2c65bbaeb19d4943d909d3a (patch)
treefdb8143db712bf02e3ca3e85c29440fffc4e727a /jetty-servlets
parentf73f2c22e3647c5a753a35d944f8608a9964fe2b (diff)
downloadorg.eclipse.jetty.project-e97c726ccff5235ee2c65bbaeb19d4943d909d3a.tar.gz
org.eclipse.jetty.project-e97c726ccff5235ee2c65bbaeb19d4943d909d3a.tar.xz
org.eclipse.jetty.project-e97c726ccff5235ee2c65bbaeb19d4943d909d3a.zip
464740 DosFilter whiteList check improvement
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 87344be882..43ce257f0f 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
@@ -578,7 +578,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);
@@ -601,6 +601,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