mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-16 07:56:12 +03:00
Performance improvement: makes the collections lookup faster
This commit is contained in:
parent
15b81d09e7
commit
6fff8c954a
@ -94,17 +94,25 @@ void InMemoryPerProcess::resolveMultiMatches(const std::string& var,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& x : *this) {
|
for (const auto& x : *this) {
|
||||||
|
bool diff = false;
|
||||||
|
|
||||||
if (x.first.size() <= keySize + 1) {
|
if (x.first.size() <= keySize + 1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (x.first.at(keySize) != ':') {
|
if (x.first.at(keySize) != ':') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::string fu = utils::string::toupper(x.first);
|
|
||||||
std::string fvar = utils::string::toupper(var);
|
for (int i = 0; i < keySize && diff == false; i++) {
|
||||||
if (fu.compare(0, keySize, fvar) != 0) {
|
if (std::tolower(x.first.at(i)) != std::tolower(var.at(i))) {
|
||||||
|
diff = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (diff == true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
l->insert(l->begin(), new Variable(x.first, x.second));
|
l->insert(l->begin(), new Variable(x.first, x.second));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user