1 /* 2 * ModSecurity, http://www.modsecurity.org/ 3 * Copyright (c) 2015 - 2021 Trustwave Holdings, Inc. (http://www.trustwave.com/) 4 * 5 * You may not use this file except in compliance with 6 * the License. You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * If any of the files related to licensing are missing or if you have any 11 * other questions related to licensing please contact Trustwave Holdings, Inc. 12 * directly using the email address security@modsecurity.org. 13 * 14 */ 15 16 #include "src/actions/transformations/length.h" 17 18 #include <iostream> 19 #include <string> 20 #include <algorithm> 21 #include <functional> 22 #include <cctype> 23 #include <locale> 24 25 #include "modsecurity/transaction.h" 26 #include "src/actions/transformations/transformation.h" 27 28 29 namespace modsecurity { 30 namespace actions { 31 namespace transformations { 32 Length(const std::string & action)33Length::Length(const std::string &action) 34 : Transformation(action) { 35 this->action_kind = 1; 36 } 37 evaluate(const std::string & value,Transaction * transaction)38std::string Length::evaluate(const std::string &value, 39 Transaction *transaction) { 40 41 return std::to_string(value.size()); 42 } 43 44 } // namespace transformations 45 } // namespace actions 46 } // namespace modsecurity 47