Adds `msc_update_status_code' method to the libmodsec api

This commit is contained in:
Felipe Zimmerle
2017-08-20 18:30:17 -03:00
parent fff5a57656
commit c22658ec80
2 changed files with 47 additions and 0 deletions

View File

@@ -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