actually support the short CIDR notation

This commit is contained in:
El RIDO 2022-02-28 16:24:06 +01:00
parent 6b001b5e4a
commit 3e02818335
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92
2 changed files with 6 additions and 3 deletions

View file

@ -146,7 +146,10 @@ class TrafficLimiter extends AbstractPersistence
$ipRange = trim($ipRange);
}
$address = Factory::parseAddressString($_SERVER[self::$_ipKey]);
$range = Factory::parseRangeString($ipRange, ParseStringFlag::IPV4_MAYBE_NON_DECIMAL);
$range = Factory::parseRangeString(
$ipRange,
ParseStringFlag::IPV4_MAYBE_NON_DECIMAL | ParseStringFlag::IPV4SUBNET_MAYBE_COMPACT | ParseStringFlag::IPV4ADDRESS_MAYBE_NON_QUAD_DOTTED
);
// address could not be parsed, we might not be in IP space and try a string comparison instead
if (is_null($address)) {