File tree Expand file tree Collapse file tree 9 files changed +5929
-5771
lines changed Expand file tree Collapse file tree 9 files changed +5929
-5771
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,7 @@ ACTIONS = \
167
167
actions/transformations/trim.cc \
168
168
actions/transformations/trim_left.cc \
169
169
actions/transformations/trim_right.cc \
170
+ actions/transformations/upper_case.cc \
170
171
actions/transformations/url_decode.cc \
171
172
actions/transformations/url_decode_uni.cc \
172
173
actions/transformations/url_encode.cc \
Original file line number Diff line number Diff line change 53
53
#include " src/actions/transformations/trim.h"
54
54
#include " src/actions/transformations/trim_left.h"
55
55
#include " src/actions/transformations/trim_right.h"
56
+ #include " src/actions/transformations/upper_case.h"
56
57
#include " src/actions/transformations/url_decode.h"
57
58
#include " src/actions/transformations/url_decode_uni.h"
58
59
#include " src/actions/transformations/url_encode.h"
@@ -109,6 +110,7 @@ Transformation* Transformation::instantiate(std::string a) {
109
110
IF_MATCH (trimLeft) { return new TrimLeft (a); }
110
111
IF_MATCH (trimRight) { return new TrimRight (a); }
111
112
IF_MATCH (trim) { return new Trim (a); }
113
+ IF_MATCH (uppercase) { return new UpperCase (a); }
112
114
IF_MATCH (urlDecodeUni) { return new UrlDecodeUni (a); }
113
115
IF_MATCH (urlDecode) { return new UrlDecode (a); }
114
116
IF_MATCH (urlEncode) { return new UrlEncode (a); }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * ModSecurity, http://www.modsecurity.org/
3
+ * Copyright (c) 2015 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 [email protected] .
13
+ *
14
+ */
15
+
16
+ #include " src/actions/transformations/upper_case.h"
17
+
18
+ #include < algorithm>
19
+ #include < string>
20
+
21
+ #include " modsecurity/transaction.h"
22
+ #include " src/actions/transformations/transformation.h"
23
+ #include " modsecurity/actions/action.h"
24
+
25
+ namespace modsecurity {
26
+ namespace actions {
27
+ namespace transformations {
28
+
29
+
30
+ UpperCase::UpperCase (std::string a)
31
+ : Transformation(a) {
32
+ }
33
+
34
+ std::string UpperCase::evaluate (std::string value,
35
+ Transaction *transaction) {
36
+ std::locale loc;
37
+
38
+ for (std::string::size_type i=0 ; i < value.length (); ++i) {
39
+ value[i] = std::toupper (value[i], loc);
40
+ }
41
+
42
+ return value;
43
+ }
44
+
45
+ } // namespace transformations
46
+ } // namespace actions
47
+ } // namespace modsecurity
Original file line number Diff line number Diff line change
1
+ /*
2
+ * ModSecurity, http://www.modsecurity.org/
3
+ * Copyright (c) 2015 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 [email protected] .
13
+ *
14
+ */
15
+
16
+ #include < string>
17
+ #include < unordered_map>
18
+
19
+ #include " modsecurity/actions/action.h"
20
+ #include " src/actions/transformations/transformation.h"
21
+
22
+ #ifndef SRC_ACTIONS_TRANSFORMATIONS_UPPER_CASE_H_
23
+ #define SRC_ACTIONS_TRANSFORMATIONS_UPPER_CASE_H_
24
+
25
+ #ifdef __cplusplus
26
+
27
+ namespace modsecurity {
28
+ class Transaction ;
29
+ namespace actions {
30
+ namespace transformations {
31
+
32
+
33
+ class UpperCase : public Transformation {
34
+ public:
35
+ explicit UpperCase (std::string action);
36
+ std::string evaluate (std::string exp,
37
+ Transaction *transaction) override ;
38
+ };
39
+
40
+ } // namespace transformations
41
+ } // namespace actions
42
+ } // namespace modsecurity
43
+
44
+ #endif
45
+
46
+ #endif // SRC_ACTIONS_TRANSFORMATIONS_UPPER_CASE_H_
You can’t perform that action at this time.
0 commit comments