Skip to content

Commit b405124

Browse files
author
Felipe Zimmerle
committed
Adds support to SecResponseBodyMimeTypesClear
1 parent 48f1470 commit b405124

File tree

8 files changed

+5926
-5820
lines changed

8 files changed

+5926
-5820
lines changed

headers/modsecurity/rules_properties.h

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ class ConfigString {
7171
};
7272

7373

74+
class ConfigSet {
75+
public:
76+
ConfigSet() : m_set(false), m_clear(false) { }
77+
bool m_set;
78+
bool m_clear;
79+
std::set<std::string> m_value;
80+
};
81+
7482
class RulesProperties {
7583
public:
7684
RulesProperties() :
@@ -334,10 +342,18 @@ class RulesProperties {
334342
to->m_components.insert(to->m_components.end(),
335343
from->m_components.begin(), from->m_components.end());
336344

337-
for (std::set<std::string>::iterator
338-
it = from->m_responseBodyTypeToBeInspected.begin();
339-
it != from->m_responseBodyTypeToBeInspected.end(); ++it) {
340-
to->m_responseBodyTypeToBeInspected.insert(*it);
345+
if (from->m_responseBodyTypeToBeInspected.m_set == true) {
346+
if (from->m_responseBodyTypeToBeInspected.m_clear == true) {
347+
to->m_responseBodyTypeToBeInspected.m_value.clear();
348+
from->m_responseBodyTypeToBeInspected.m_value.clear();
349+
} else {
350+
for (std::set<std::string>::iterator
351+
it = from->m_responseBodyTypeToBeInspected.m_value.begin();
352+
it != from->m_responseBodyTypeToBeInspected.m_value.end(); ++it) {
353+
to->m_responseBodyTypeToBeInspected.m_value.insert(*it);
354+
}
355+
}
356+
to->m_responseBodyTypeToBeInspected.m_set = true;
341357
}
342358

343359
for (int i = 0; i <= modsecurity::Phases::NUMBER_OF_PHASES; i++) {
@@ -447,7 +463,7 @@ class RulesProperties {
447463
RulesExceptions m_exceptions;
448464
std::list<std::string> m_components;
449465
std::ostringstream m_parserError;
450-
std::set<std::string> m_responseBodyTypeToBeInspected;
466+
ConfigSet m_responseBodyTypeToBeInspected;
451467
ConfigString m_httpblKey;
452468
ConfigString m_uploadDirectory;
453469
ConfigString m_uploadTmpDirectory;

0 commit comments

Comments
 (0)