Merge remote-tracking branch 'origin/jetty-9.2.x'
This commit is contained in:
commit
a593d8eef6
|
@ -1038,30 +1038,18 @@ public class DoSFilter implements Filter
|
|||
/**
|
||||
* Set a list of IP addresses that will not be rate limited.
|
||||
*
|
||||
* @param value comma-separated whitelist
|
||||
* @param commaSeparatedList comma-separated whitelist
|
||||
*/
|
||||
public void setWhitelist(String value)
|
||||
public void setWhitelist(String commaSeparatedList)
|
||||
{
|
||||
List<String> result = new ArrayList<>();
|
||||
for (String address : value.split(","))
|
||||
for (String address : commaSeparatedList.split(","))
|
||||
addWhitelistAddress(result, address);
|
||||
clearWhitelist();
|
||||
_whitelist.addAll(result);
|
||||
LOG.debug("Whitelisted IP addresses: {}", result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a list of IP addresses that will not be rate limited.
|
||||
*
|
||||
* @param values whitelist
|
||||
*/
|
||||
public void setWhitelist(List<String> values)
|
||||
{
|
||||
clearWhitelist();
|
||||
_whitelist.addAll(values);
|
||||
LOG.debug("Whitelisted IP addresses: {}", values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the list of whitelisted IP addresses
|
||||
*/
|
||||
|
|
|
@ -83,7 +83,7 @@ public class DoSFilterTest extends AbstractDoSFilterTest
|
|||
whitelist.add("10.0.0.0/8");
|
||||
whitelist.add("4d8:0:a:1234:ABc:1F:b18:17");
|
||||
whitelist.add("4d8:0:a:1234:ABc:1F:0:0/96");
|
||||
filter.setWhitelist(whitelist);
|
||||
filter.setWhitelist("192.168.0.1/32,10.0.0.0/8,4d8:0:a:1234:ABc:1F:b18:17,4d8:0:a:1234:ABc:1F:0:0/96");
|
||||
Assert.assertTrue(filter.checkWhitelist("192.168.0.1"));
|
||||
Assert.assertFalse(filter.checkWhitelist("192.168.0.2"));
|
||||
Assert.assertFalse(filter.checkWhitelist("11.12.13.14"));
|
||||
|
|
Loading…
Reference in New Issue