Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion headers/modsecurity/anchored_variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class AnchoredVariable {

void unset();
void set(const std::string &a, size_t offset);
void set(std::string &&a, size_t offset);
void set(const std::string &a, size_t offset, size_t offsetLen);

void evaluate(std::vector<const VariableValue *> *l);
Expand All @@ -72,4 +73,3 @@ class AnchoredVariable {


#endif // HEADERS_MODSECURITY_ANCHORED_VARIABLE_H_

9 changes: 7 additions & 2 deletions headers/modsecurity/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ class Transaction : public TransactionAnchoredVariables, public TransactionSecMa
const char *getResponseBody() const;
size_t getResponseBodyLength();
size_t getRequestBodyLength();
size_t getResponseBodyLength() const;
size_t getRequestBodyLength() const;
Comment thread
JakubOnderka marked this conversation as resolved.
Resolved

#ifndef NO_LOGS
void debug(int level, const std::string& message) const;
Expand Down Expand Up @@ -568,12 +570,12 @@ class Transaction : public TransactionAnchoredVariables, public TransactionSecMa
/**
* Holds the request body, in case of any.
*/
std::ostringstream m_requestBody;
std::string m_requestBody;

/**
* Holds the response body, in case of any.
*/
std::ostringstream m_responseBody;
std::string m_responseBody;

/**
* Contains the unique ID of the transaction. Use by the variable
Expand Down Expand Up @@ -660,6 +662,9 @@ class Transaction : public TransactionAnchoredVariables, public TransactionSecMa
Transaction(ModSecurity *ms, RulesSet *rules, const char *id,
void *logCbData, const time_t timestamp);

void reserveBody(std::string &body, AnchoredSetVariable &headers,
double limit, size_t incoming);

/**
* Pointer to the callback function that will be called to fill
* the web server (connector) log.
Expand Down
13 changes: 11 additions & 2 deletions src/anchored_variable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,22 @@ void AnchoredVariable::set(const std::string &a, size_t offset) {
}


void AnchoredVariable::set(std::string &&a, size_t offset) {
m_offset = offset;
m_value = std::move(a);
m_var.addOrigin(m_value.size(), offset);
}


void AnchoredVariable::evaluate(std::vector<const VariableValue *> *l) {
if (m_name.empty()) {
return;
}

m_var.setValue(m_value);
l->push_back(new VariableValue(&m_var));
auto value = std::make_unique<VariableValue>(&m_var);
value->setValue(m_value);
l->push_back(value.get());
value.release();
}


Expand Down
Loading
Loading