mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-15 23:55:03 +03:00
Performance improvement while expanding macros
This commit is contained in:
parent
3351338551
commit
74045beab5
@ -34,9 +34,15 @@ std::string MacroExpansion::expandKeepOriginal(const std::string& input,
|
|||||||
|
|
||||||
|
|
||||||
std::string MacroExpansion::expand(const std::string& input, Assay *assay) {
|
std::string MacroExpansion::expand(const std::string& input, Assay *assay) {
|
||||||
std::string res(input);
|
std::string res;
|
||||||
|
size_t pos = input.find("%{");
|
||||||
|
|
||||||
|
if (pos != std::string::npos) {
|
||||||
|
res = input;
|
||||||
|
} else {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
size_t pos = res.find("%{");
|
|
||||||
while (pos != std::string::npos) {
|
while (pos != std::string::npos) {
|
||||||
size_t start = pos;
|
size_t start = pos;
|
||||||
size_t end = res.find("}");
|
size_t end = res.find("}");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user