mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Removes local cache for transformations
This commit is contained in:
parent
0e05b7bb8a
commit
37619bae77
@ -29,24 +29,6 @@ class Transaction;
|
||||
namespace actions {
|
||||
namespace transformations {
|
||||
|
||||
class LowerCaseInstantCache :
|
||||
public std::unordered_map<std::string, std::string> {
|
||||
public:
|
||||
static LowerCaseInstantCache& getInstance() {
|
||||
static LowerCaseInstantCache instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void cache(const std::string& value, const std::string& out) {
|
||||
emplace(value, out);
|
||||
if (size() > 100) {
|
||||
erase(begin());
|
||||
}
|
||||
}
|
||||
private:
|
||||
LowerCaseInstantCache() {}
|
||||
};
|
||||
|
||||
|
||||
class LowerCase : public Transformation {
|
||||
public:
|
||||
|
@ -43,10 +43,6 @@ std::string UrlDecode::evaluate(std::string value,
|
||||
int invalid_count;
|
||||
int changed;
|
||||
|
||||
if (UrlDecodeInstantCache::getInstance().count(value) > 0) {
|
||||
return UrlDecodeInstantCache::getInstance().at(value);
|
||||
}
|
||||
|
||||
val = (unsigned char *) malloc(sizeof(char) * value.size() + 1);
|
||||
memcpy(val, value.c_str(), value.size() + 1);
|
||||
val[value.size()] = '\0';
|
||||
@ -59,8 +55,6 @@ std::string UrlDecode::evaluate(std::string value,
|
||||
|
||||
free(val);
|
||||
|
||||
UrlDecodeInstantCache::getInstance().cache(value, out);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -29,24 +29,6 @@ class Transaction;
|
||||
namespace actions {
|
||||
namespace transformations {
|
||||
|
||||
class UrlDecodeInstantCache :
|
||||
public std::unordered_map<std::string, std::string> {
|
||||
public:
|
||||
static UrlDecodeInstantCache& getInstance() {
|
||||
static UrlDecodeInstantCache instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void cache(const std::string& value, const std::string& out) {
|
||||
emplace(value, out);
|
||||
if (size() > 500) {
|
||||
erase(begin());
|
||||
}
|
||||
}
|
||||
private:
|
||||
UrlDecodeInstantCache() {}
|
||||
};
|
||||
|
||||
|
||||
class UrlDecode : public Transformation {
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user