mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Reference RuleWithActions & Transaction object instead of copying values in RuleMessage
- Because the lifetime of the RuleMessage instances do not extend beyond the lifetime of the enclosing RuleWithActions & Transaction, RuleMessage can just reference it and simplify its definition. - Additionally, make the references const to show that it doesn't modify it. - Replace RuleMessage copy constructor with default implementations. - Removed unused RuleMessage assignment operator (which cannot be implemented now that it has reference members). - Removed constructor from RuleMessage pointer. - Addressed Sonarcloud suggestions: Do not use the constructor's initializer list for data member "xxx". Use the in-class initializer instead.
This commit is contained in:
@@ -57,7 +57,7 @@ typedef struct Rules_t RulesSet;
|
||||
#define ms_dbg(b, c) \
|
||||
do { \
|
||||
if (m_rules && m_rules->m_debugLog && m_rules->m_debugLog->m_debugLevel >= b) { \
|
||||
m_rules->debug(b, *m_id.get(), m_uri, c); \
|
||||
m_rules->debug(b, m_id, m_uri, c); \
|
||||
} \
|
||||
} while (0);
|
||||
#else
|
||||
@@ -431,7 +431,7 @@ class Transaction : public TransactionAnchoredVariables, public TransactionSecMa
|
||||
/**
|
||||
* Holds the client IP address.
|
||||
*/
|
||||
std::shared_ptr<std::string> m_clientIpAddress;
|
||||
std::string m_clientIpAddress;
|
||||
|
||||
/**
|
||||
* Holds the HTTP version: 1.2, 2.0, 3.0 and so on....
|
||||
@@ -441,12 +441,12 @@ class Transaction : public TransactionAnchoredVariables, public TransactionSecMa
|
||||
/**
|
||||
* Holds the server IP Address
|
||||
*/
|
||||
std::shared_ptr<std::string> m_serverIpAddress;
|
||||
std::string m_serverIpAddress;
|
||||
|
||||
/**
|
||||
* Holds the request's hostname
|
||||
*/
|
||||
std::shared_ptr<std::string> m_requestHostName;
|
||||
std::string m_requestHostName;
|
||||
|
||||
/**
|
||||
* Holds the raw URI that was requested.
|
||||
@@ -456,7 +456,7 @@ class Transaction : public TransactionAnchoredVariables, public TransactionSecMa
|
||||
/**
|
||||
* Holds the URI that was requests (without the query string).
|
||||
*/
|
||||
std::shared_ptr<std::string> m_uri_no_query_string_decoded;
|
||||
std::string m_uri_no_query_string_decoded;
|
||||
|
||||
/**
|
||||
* Holds the combined size of all arguments, later used to fill the
|
||||
@@ -568,7 +568,7 @@ class Transaction : public TransactionAnchoredVariables, public TransactionSecMa
|
||||
* Contains the unique ID of the transaction. Use by the variable
|
||||
* `UNIQUE_ID'. This unique id is also saved as part of the AuditLog.
|
||||
*/
|
||||
std::shared_ptr<std::string> m_id;
|
||||
std::string m_id;
|
||||
|
||||
/**
|
||||
* Holds the amount of rules that should be skipped. If bigger than 0 the
|
||||
|
Reference in New Issue
Block a user