mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-18 02:10:36 +03:00
Testing performance enhancements by enabling transformations cache
Also reduce the utilization of dynamic cast.
This commit is contained in:
@@ -36,12 +36,19 @@ namespace transformations {
|
||||
|
||||
std::string HtmlEntityDecode::evaluate(std::string value,
|
||||
Assay *assay) {
|
||||
|
||||
if (HtmlEntityDecodeInstantCache::getInstance().count(value) > 0) {
|
||||
return HtmlEntityDecodeInstantCache::getInstance().at(value);
|
||||
}
|
||||
|
||||
char *tmp = strdup(value.c_str());
|
||||
html_entities_decode_inplace((unsigned char *)tmp, value.size());
|
||||
std::string ret("");
|
||||
ret.assign(tmp);
|
||||
free(tmp);
|
||||
|
||||
HtmlEntityDecodeInstantCache::getInstance().emplace(value, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user