mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 03:34:29 +03:00
Adds `msc_update_status_code' method to the libmodsec api
This commit is contained in:
@@ -1694,6 +1694,29 @@ int Transaction::getRuleEngineState() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @name updateStatusCode
|
||||
* @brief Updates response status code.
|
||||
*
|
||||
* Called after processResponseHeaders to inform a new response code.
|
||||
* Not mandatory.
|
||||
*
|
||||
*
|
||||
* @param status The returned http code.
|
||||
*
|
||||
* @returns If the operation was successful or not.
|
||||
* @retval true Operation was successful.
|
||||
* @retval false Operation failed.
|
||||
*
|
||||
*/
|
||||
int Transaction::updateStatusCode(int code) {
|
||||
this->m_httpCodeReturned = code;
|
||||
m_variableResponseStatus.set(std::to_string(code), m_variableOffset);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @name msc_new_transaction
|
||||
* @brief Create a new transaction for a given configuration and ModSecurity core.
|
||||
@@ -2126,5 +2149,25 @@ extern "C" int msc_process_logging(Transaction *transaction) {
|
||||
return transaction->processLogging();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @name msc_update_status_code
|
||||
* @brief Updates response status code.
|
||||
*
|
||||
* Called after msc_process_response_headers to inform a new response code.
|
||||
* Not mandatory.
|
||||
*
|
||||
* @param transaction ModSecurity transaction.
|
||||
*
|
||||
* @returns If the operation was successful or not.
|
||||
* @retval 1 Operation was successful.
|
||||
* @retval 0 Operation failed.
|
||||
*
|
||||
*/
|
||||
extern "C" int msc_update_status_code(Transaction *transaction, int status) {
|
||||
return transaction->updateStatusCode(status);
|
||||
}
|
||||
|
||||
|
||||
} // namespace modsecurity
|
||||
|
||||
|
Reference in New Issue
Block a user