Actions refactoring: now there is a clear definiation on the action name

This commit is contained in:
Felipe Zimmerle
2016-05-17 14:36:59 -03:00
parent 1b88947d9b
commit 8c714af8e1
62 changed files with 431 additions and 359 deletions

View File

@@ -27,14 +27,16 @@
namespace modsecurity {
namespace actions {
Accuracy::Accuracy(std::string action)
: Action(action, ConfigurationKind),
m_accuracy_str(action) {
if (m_accuracy_str.at(0) == '\'') {
m_accuracy_str.erase(0, 1);
m_accuracy_str.pop_back();
bool Accuracy::init(std::string *error) {
try {
m_accuracy = std::stoi(m_parser_payload);
} catch (...) {
error->assign("Accuracy: The input \"" + m_parser_payload + "\" is " \
"not a number.");
return false;
}
m_accuracy = std::stoi(m_accuracy_str);
return true;
}
@@ -43,5 +45,6 @@ bool Accuracy::evaluate(Rule *rule, Transaction *transaction) {
return true;
}
} // namespace actions
} // namespace modsecurity