mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-15 23:55:03 +03:00
Adds `msc_update_status_code' method to the libmodsec api
This commit is contained in:
parent
fff5a57656
commit
c22658ec80
@ -309,6 +309,7 @@ class Transaction : public TransactionAnchoredVariables {
|
|||||||
int appendResponseBody(const unsigned char *body, size_t size);
|
int appendResponseBody(const unsigned char *body, size_t size);
|
||||||
|
|
||||||
int processLogging();
|
int processLogging();
|
||||||
|
int updateStatusCode(int status);
|
||||||
|
|
||||||
bool intervention(ModSecurityIntervention *it);
|
bool intervention(ModSecurityIntervention *it);
|
||||||
|
|
||||||
@ -622,6 +623,9 @@ int msc_intervention(Transaction *transaction, ModSecurityIntervention *it);
|
|||||||
/** @ingroup ModSecurity_C_API */
|
/** @ingroup ModSecurity_C_API */
|
||||||
int msc_process_logging(Transaction *transaction);
|
int msc_process_logging(Transaction *transaction);
|
||||||
|
|
||||||
|
/** @ingroup ModSecurity_C_API */
|
||||||
|
int msc_update_status_code(Transaction *transaction, int status);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
} // namespace modsecurity
|
} // namespace modsecurity
|
||||||
|
@ -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
|
* @name msc_new_transaction
|
||||||
* @brief Create a new transaction for a given configuration and ModSecurity core.
|
* @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();
|
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
|
} // namespace modsecurity
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user