mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
- Renamed Transformation::evaluate to Transformation::transform to avoid confusion with Action's overload methods. - Updated Transformation::transform signature to receive the value by reference and perform the transformation inline, if possible. - Some transformations still need to use a temporary std::string to perform their work, and then copy the result back. - Made Transformation::transform methods const and updated Transaction parameter to be const. - Transaction parameter could not be removed because it's used by just a single transformation, UrlDecodeUni. - Removed std::string Action::evaluate(const std::string &exp, Transaction *transaction); which was only implemented by Transformation but was not used from the base class, but only after downcasting to Transformation, so it can just be declared there (and not pollute other actions with a default member implementation -that does nothing- which is never called).
34 lines
1005 B
C++
34 lines
1005 B
C++
/*
|
|
* ModSecurity, http://www.modsecurity.org/
|
|
* Copyright (c) 2015 - 2021 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
|
*
|
|
* You may not use this file except in compliance with
|
|
* the License. You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* If any of the files related to licensing are missing or if you have any
|
|
* other questions related to licensing please contact Trustwave Holdings, Inc.
|
|
* directly using the email address security@modsecurity.org.
|
|
*
|
|
*/
|
|
|
|
#ifndef SRC_ACTIONS_TRANSFORMATIONS_TRIM_LEFT_H_
|
|
#define SRC_ACTIONS_TRANSFORMATIONS_TRIM_LEFT_H_
|
|
|
|
#include "transformation.h"
|
|
#include "trim.h"
|
|
|
|
namespace modsecurity::actions::transformations {
|
|
|
|
class TrimLeft : public Trim {
|
|
public:
|
|
explicit TrimLeft(const std::string &action);
|
|
|
|
bool transform(std::string &value, const Transaction *trans) const override;
|
|
};
|
|
|
|
} // namespace modsecurity::actions::transformations
|
|
|
|
#endif // SRC_ACTIONS_TRANSFORMATIONS_TRIM_LEFT_H_
|